home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / inet / internet-drafts / draft-ietf-cat-kerberos-01.txt < prev    next >
Text File  |  1993-03-03  |  300KB  |  8,386 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. INTERNET-DRAFT                                     John Kohl
  8.                                           B. Clifford Neuman
  9.                                             1 September 1992
  10.  
  11.  
  12.  
  13.      The Kerberos Network Authentication Service (V5)
  14.  
  15.  
  16. _S_T_A_T_U_S _O_F _T_H_I_S _M_E_M_O
  17.  
  18.      This document is an Internet  Draft.   Internet  Drafts
  19. are working documents of the Internet Engineering Task Force
  20. (IETF), its Areas, and its Working Groups. Note  that  other
  21. groups  may  also  distribute  working documents as Internet
  22. Drafts.
  23.  
  24.      Internet Drafts are draft documents valid for a maximum
  25. of  six  months.   Internet Drafts may be updated, replaced,
  26. or obsoleted by other documents at  any  time.   It  is  not
  27. appropriate  to use Internet Drafts as reference material or
  28. to cite them other than as a "working  draft"  or  "work  in
  29. progress."
  30.  
  31.      Please check the I-D abstract listing contained in each
  32. Internet Draft directory to learn the current status of this
  33. or any other Internet Draft.  Distribution of this  memo  is
  34. unlimited. Please send comments to "krb-protocol@MIT.EDU."
  35.  
  36. _A_B_S_T_R_A_C_T
  37.  
  38.      This document gives an overview  and  specification  of
  39. Version 5 of the protocol for the Kerberos network authenti-
  40. cation system.  Version 4,  described  elsewhere  [1,2],  is
  41. presently  in production use at MIT's Project Athena, and at
  42. other Internet sites.
  43.  
  44. _O_V_E_R_V_I_E_W
  45.  
  46.      This INTERNET-DRAFT describes the  concepts  and  model
  47. upon  which  the  Kerberos  network authentication system is
  48. based.  It also specifies Version 5 of the  Kerberos  proto-
  49. col.
  50.  
  51.      The  motivations,  goals,  assumptions,  and  rationale
  52. behind most design decisions are treated cursorily; for Ver-
  53. sion 4 they are fully described in the Kerberos  portion  of
  54. __________________________
  55. Project Athena, Athena, Athena MUSE,  Discuss,  Hesiod,
  56. Kerberos,  Moira, and Zephyr are trademarks of the Mas-
  57. sachusetts Institute of Technology (MIT).   No  commer-
  58. cial  use of these trademarks may be made without prior
  59. written permission of MIT.
  60.  
  61.  
  62.  
  63. Overview                   - 1 -    Expires 28 February 1993
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.                   Version 5 - Revision 5.1
  71.  
  72.  
  73. the Athena Technical Plan  [1].   The  protocols  are  under
  74. review,  and are not being submitted for consideration as an
  75. Internet standard at this time.   Comments  are  encouraged.
  76. Requests for addition to an electronic mailing list for dis-
  77. cussion of Kerberos, kerberos@MIT.EDU, may be  addressed  to
  78. kerberos-request@MIT.EDU.   This  mailing  list is gatewayed
  79. onto  the  Usenet  as  the  group   comp.protocols.kerberos.
  80. Requests  for  further  information, including documents and
  81. code availability, may be sent to info-kerberos@MIT.EDU.
  82. _B_A_C_K_G_R_O_U_N_D
  83.  
  84.      The Kerberos model is based  in  part  on  Needham  and
  85. Schroeder's  trusted third-party authentication protocol [3]
  86. and on modifications suggested by  Denning  and  Sacco  [4].
  87. The  original design and implementation of Kerberos Versions
  88. 1 through 4 was the work of two former Project Athena  staff
  89. members,  Steve  Miller of Digital Equipment Corporation and
  90. Clifford Neuman (now at the Information  Sciences  Institute
  91. of the University of Southern California), along with Jerome
  92. Saltzer, Technical Director of Project Athena,  and  Jeffrey
  93. Schiller, MIT Campus Network Manager.  Many other members of
  94. Project Athena have also contributed to  the  work  on  Ker-
  95. beros.   Version  4 is publicly available, and has seen wide
  96. use across the Internet.
  97.  
  98.      Version 5 (described in this document) has evolved from
  99. Version 4 based on new requirements and desires for features
  100. not available in Version  4.   Details  on  the  differences
  101. between Kerberos Versions 4 and 5 can be found in [5].
  102.  
  103. _1.  _I_n_t_r_o_d_u_c_t_i_o_n
  104.  
  105.      Kerberos provides a means of verifying  the  identities
  106. of principals, (e.g. a workstation user or a network server)
  107. on an open  (unprotected)  network.   This  is  accomplished
  108. without relying on authentication by the host operating sys-
  109. tem, without basing trust on host addresses, without requir-
  110. ing  physical  security of all the hosts on the network, and
  111. under the assumption that packets traveling along  the  net-
  112. work can be read, modified, and inserted at  will[1].   Ker-
  113. beros  performs  authentication  under these conditions as a
  114. trusted third-party authentication service by using  conven-
  115. tional (shared secret key[2]) cryptography.
  116. __________________________
  117. [1] Note, however, that many applications use Kerberos'
  118. functions  only  upon  the initiation of a stream-based
  119. network connection, and assume the absence of any ``hi-
  120. jackers''  who  might  subvert such a connection.  Such
  121. use implicitly trusts the host addresses involved.
  122. [2] _S_e_c_r_e_t  and  _p_r_i_v_a_t_e are often used interchangeably
  123. in the literature.  In our  usage,  it  takes  two  (or
  124. more)  to  share  a  secret, thus a shared DES key is a
  125. _s_e_c_r_e_t key.  Something is only private when no one  but
  126.  
  127. Section 1.                 - 2 -    Expires 28 February 1993
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.                   Version 5 - Revision 5.1
  135.  
  136.  
  137.      The  authentication  process  proceeds  as  follows:  A
  138. client  sends  a  request  to the authentication server (AS)
  139. requesting  "credentials"  for  a  given  server.   The   AS
  140. responds  with  these credentials, encrypted in the client's
  141. key.  The credentials consist  of  1)  a  "ticket"  for  the
  142. server  and  2)  a  temporary encryption key (often called a
  143. "session key").  The client transmits the ticket (which con-
  144. tains  the  client's identity and a copy of the session key,
  145. all encrypted in the server's key) to the server.  The  ses-
  146. sion  key  (now  shared by the client and server) is used to
  147. authenticate the client,  and  may  optionally  be  used  to
  148. authenticate  the  server.   It  may also be used to encrypt
  149. further communication between the two parties or to exchange
  150. a  separate  sub-session  key  to be used to encrypt further
  151. communication.
  152.  
  153.      The implementation consists of one or more  authentica-
  154. tion  servers  running  on  physically  secure  hosts.   The
  155. authentication servers maintain  a  database  of  principals
  156. (i.e.,  users  and  servers)  and  their  secret keys.  Code
  157. libraries provide encryption and implement the Kerberos pro-
  158. tocol.   In order to add authentication to its transactions,
  159. a typical network application adds one or two calls  to  the
  160. Kerberos  library,  which results in the transmission of the
  161. necessary messages to achieve authentication.
  162.  
  163.      The Kerberos protocol consists of several sub-protocols
  164. (or exchanges).  There are two methods by which a client can
  165. ask  a  Kerberos  server  for  credentials.   In  the  first
  166. approach,  the client sends a cleartext request for a ticket
  167. for the desired  server  to  the  AS.   The  reply  is  sent
  168. encrypted  in the client's secret key.  Usually this request
  169. is for a ticket-granting ticket (TGT)  which  can  later  be
  170. used  with  the ticket-granting server (TGS).  In the second
  171. method, the client sends a request to the TGS.   The  client
  172. sends  the  TGT  to the TGS in the same manner as if it were
  173. contacting any other application server which requires  Ker-
  174. beros  credentials.   The  reply is encrypted in the session
  175. key from the TGT.
  176.  
  177.      Once obtained, credentials may be used  to  verify  the
  178. identity  of  the principals in a transaction, to ensure the
  179. integrity of messages exchanged between them, or to preserve
  180. privacy  of the messages.  The application is free to choose
  181. whatever protection may be necessary.
  182.  
  183.      To verify the identities of the principals in  a  tran-
  184. saction,  the  client  transmits  the  ticket to the server.
  185. Since the ticket is sent "in the clear"  (parts  of  it  are
  186. encrypted,  but  this  encryption doesn't thwart replay) and
  187. __________________________
  188. its owner knows it.  Thus, in public key cryptosystems,
  189. one has a public and a _p_r_i_v_a_t_e key.
  190.  
  191.  
  192.  
  193. Section 1.                 - 3 -    Expires 28 February 1993
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.                   Version 5 - Revision 5.1
  201.  
  202.  
  203. might be intercepted and reused by an  attacker,  additional
  204. information is sent to prove that the message was originated
  205. by the principal to whom the ticket was issued.  This infor-
  206. mation  (called  the _a_u_t_h_e_n_t_i_c_a_t_o_r) is encrypted
  207. in the session key, and includes a timestamp.   The  timestamp  
  208. proves that the message was recently generated and is not a 
  209. replay.  Encrypting the authenticator in the session key proves  
  210. that it  was  generated  by  a  party possessing the session key.
  211. Since no one except the requesting principal and the  server
  212. know  the  session key (it is never sent over the network in
  213. the clear) this guarantees the identity of the client.
  214.  
  215.      The integrity of the messages exchanged between princi-
  216. pals can also be guaranteed using the session key (passed in
  217. the ticket and contained in the credentials).  This approach
  218. provides detection of both replay attacks and message stream
  219. modification attacks.  It is accomplished by generating  and
  220. transmitting  a collision-proof checksum (elsewhere called a
  221. hash or digest function) of the client's message, keyed with
  222. the  session  key.   Privacy  and  integrity of the messages
  223. exchanged between principals can be  secured  by  encrypting
  224. the  data  to  be passed using the session key passed in the
  225. ticket, and contained in the credentials.
  226.  
  227.      The authentication exchanges  mentioned  above  require
  228. read-only  access to the Kerberos database.  Sometimes, how-
  229. ever, the entries in the database must be modified, such  as
  230. when  adding  new  principals or changing a principal's key.
  231. This is done using a protocol between a client and  a  third
  232. Kerberos  server, the Kerberos Administration Server (KADM).
  233. The administration protocol is not described in  this  docu-
  234. ment.   There  is  also  a protocol for maintaining multiple
  235. copies of the Kerberos database, but this can be  considered
  236. an  implementation  detail and may vary to support different
  237. database technologies.
  238.  
  239. _1._1.  _C_r_o_s_s-_R_e_a_l_m _O_p_e_r_a_t_i_o_n
  240.  
  241.      The Kerberos protocol is  designed  to  operate  across
  242. organizational boundaries.  A client in one organization can
  243. be authenticated to a server in another.  Each  organization
  244. wishing  to  run  a  Kerberos  server  establishes  its  own
  245. "realm".  The name  of  the  realm  in  which  a  client  is
  246. registered  is part of the client's name, and can be used by
  247. the end-service to decide whether to honor a request.
  248.  
  249.      By establishing "inter-realm" keys, the  administrators
  250. of  two realms can allow a client authenticated in the local
  251. realm to use its authentication remotely[3].   The  exchange
  252. __________________________
  253. [3] Of course, with appropriate permission  the  client
  254. could  arrange registration of a separately-named prin-
  255. cipal in a remote realm, and engage in normal exchanges
  256. with  that  realm's  services.  However, for even small
  257.  
  258. Section 1.1.               - 4 -    Expires 28 February 1993
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.                   Version 5 - Revision 5.1
  266.  
  267.  
  268. of inter-realm keys (a separate key may  be  used  for  each
  269. direction)  registers  the  ticket-granting  service of each
  270. realm as a principal in the other realm.  A client  is  then
  271. able  to  obtain  a  ticket-granting  ticket  for the remote
  272. realm's ticket-granting service from its local realm.   When
  273. that  ticket-granting  ticket  is  used,  the remote ticket-
  274. granting service uses the  inter-realm  key  (which  usually
  275. differs  from its own normal TGS key) to decrypt the ticket-
  276. granting ticket, and is thus certain that it was  issued  by
  277. the  client's own TGS.  Tickets issued by the remote ticket-
  278. granting service will indicate to the end-service  that  the
  279. client was authenticated from another realm.
  280.  
  281.      A realm is said to _c_o_m_m_u_n_i_c_a_t_e with  another  realm  if
  282. the  two  realms  share  an inter-realm key, or if the local
  283. realm shares an inter-realm key with an  intermediate  realm
  284. that  communicates with the remote realm.  An _a_u_t_h_e_n_t_i_c_a_t_i_o_n
  285. _p_a_t_h is the sequence of intermediate realms that  are  tran-
  286. sited in communicating from one realm to another.
  287.  
  288.      Realms are typically  organized  hierarchically.   Each
  289. realm  shares a key with its parent and a different key with
  290. each child.  If an inter-realm key is not directly shared by
  291. two  realms, the hierarchical organization allows an authen-
  292. tication path to be easily constructed.  If  a  hierarchical
  293. organization  is  not  used,  it may be necessary to consult
  294. some database in order to construct an  authentication  path
  295. between realms.
  296.  
  297.      Although realms are typically hierarchical,  intermedi-
  298. ate  realms may be bypassed to achieve cross-realm authenti-
  299. cation through alternate authentication paths  (these  might
  300. be established to make communication between two realms more
  301. efficient).  It is important for  the  end-service  to  know
  302. which  realms were transited when deciding how much faith to
  303. place in the authentication  process.   To  facilitate  this
  304. decision,  a  field in each ticket contains the names of the
  305. realms that were involved in authenticating the client.
  306. _1._2.  _E_n_v_i_r_o_n_m_e_n_t_a_l _a_s_s_u_m_p_t_i_o_n_s
  307.  
  308. Kerberos imposes a few assumptions  on  the  environment  in
  309. which it can properly function:
  310.  
  311. o+    "Denial of service" attacks are not  solved  with  Ker-
  312.      beros.   There  are  places in these protocols where an
  313.      intruder can prevent an application from  participating
  314.      in  the  proper  authentication  steps.   Detection and
  315.      solution of such attacks (some of which can  appear  to
  316.      be  not-uncommon "normal" failure modes for the system)
  317.      is usually best left to the  human  administrators  and
  318. __________________________
  319. numbers of clients this becomes  cumbersome,  and  more
  320. automatic methods as described here are necessary.
  321.  
  322. Section 1.2.               - 5 -    Expires 28 February 1993
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.                   Version 5 - Revision 5.1
  330.  
  331.  
  332.      users.
  333.  
  334. o+    Principals must keep their secret keys secret.   If  an
  335.      intruder  somehow  steals a principal's key, it will be
  336.      able to masquerade as that principal or impersonate any
  337.      server to the legitimate principal.
  338.  
  339. o+    Each host on the network must have  a  clock  which  is
  340.      "loosely  synchronized" to the time of the other hosts;
  341.      this synchronization is used to reduce the  bookkeeping
  342.      needs of application servers when they do replay detec-
  343.      tion.  The degree of "looseness" can be configured on a
  344.      per-server  basis.  If the clocks are synchronized over
  345.      the network, the clock  synchronization  protocol  must
  346.      itself be secured from network attackers.
  347.  
  348. o+    Principal identifiers are not recycled on a  short-term
  349.      basis.   A  typical  mode  of  access  control will use
  350.      access control lists (ACLs)  to  grant  permissions  to
  351.      particular  principals.   If  a stale ACL entry remains
  352.      for a deleted principal and the principal identifier is
  353.      reused, the new principal will inherit rights specified
  354.      in the stale ACL  entry.   By  not  re-using  principal
  355.      identifiers,   the  danger  of  inadvertent  access  is
  356.      removed.
  357.  
  358. _1._3.  _G_l_o_s_s_a_r_y _o_f _t_e_r_m_s
  359.  
  360. Below is a list of terms used throughout this document.
  361.  
  362.  
  363. Authentication      Verifying  the  claimed  identity  of  a
  364.                     principal.
  365.  
  366.  
  367. Authentication headerA record containing  a  Ticket  and  an
  368.                     Authenticator   to  be  presented  to  a
  369.                     server as  part  of  the  authentication
  370.                     process.
  371.  
  372.  
  373. Authentication path A sequence of intermediate realms  tran-
  374.                     sited in the authentication process when
  375.                     communicating from one realm to another.
  376.  
  377.  
  378. Authenticator       A record containing information that can
  379.                     be shown to have been recently generated
  380.                     using the session key known only by  the
  381.                     client and server.
  382.  
  383.  
  384. Authorization       The process  of  determining  whether  a
  385.                     client may use a service,  which objects
  386.  
  387.  
  388. Section 1.3.               - 6 -    Expires 28 February 1993
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.                   Version 5 - Revision 5.1
  396.  
  397.  
  398.                     the client is allowed to access, and the
  399.                     type of access allowed for each.
  400.  
  401.  
  402. Capability          A token that grants the  bearer  permis-
  403.                     sion to access an object or service.  In
  404.                     Kerberos, this might be a  ticket  whose
  405.                     use is restricted by the contents of the
  406.                     authorization  data  field,  but   which
  407.                     lists  no  network  addresses,  together
  408.                     with the session key  necessary  to  use
  409.                     the ticket.
  410.  
  411.  
  412. Ciphertext          The output of  an  encryption  function.
  413.                     Encryption   transforms  plaintext  into
  414.                     ciphertext.
  415.  
  416.  
  417. Client              A process that makes use  of  a  network
  418.                     service  on behalf of a user.  Note that
  419.                     in some cases a Server may itself  be  a
  420.                     client  of  some  other  server  (e.g. a
  421.                     print server may be a client of  a  file
  422.                     server).
  423.  
  424.  
  425. Credentials         A ticket plus  the  secret  session  key
  426.                     necessary   to   successfully  use  that
  427.                     ticket in an authentication exchange.
  428.  
  429.  
  430. KDC                 Key Distribution Center, a network  ser-
  431.                     vice that supplies tickets and temporary
  432.                     session keys; or  an  instance  of  that
  433.                     service  or  the  host on which it runs.
  434.                     The KDC services both initial ticket and
  435.                     ticket-granting  ticket  requests.   The
  436.                     initial  ticket  portion  is   sometimes
  437.                     referred to as the Authentication Server
  438.                     (or   service).    The   ticket-granting
  439.                     ticket  portion is sometimes referred to
  440.                     as the ticket-granting server  (or  ser-
  441.                     vice).
  442.  
  443.  
  444. Kerberos            Aside from  the  3-headed  dog  guarding
  445.                     Hades,   the   name   given  to  Project
  446.                     Athena's  authentication  service,   the
  447.                     protocol  used  by  that service, or the
  448.                     code used to implement  the  authentica-
  449.                     tion service.
  450.  
  451.  
  452.  
  453.  
  454. Section 1.3.               - 7 -    Expires 28 February 1993
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.                   Version 5 - Revision 5.1
  462.  
  463.  
  464. Plaintext           The input to an encryption  function  or
  465.                     the  output  of  a  decryption function.
  466.                     Decryption  transforms  ciphertext  into
  467.                     plaintext.
  468.  
  469.  
  470. Principal           A  uniquely  named  client   or   server
  471.                     instance  that participates in a network
  472.                     communication.
  473.  
  474.  
  475. Principal identifierThe name used to uniquely identify  each
  476.                     different principal.
  477.  
  478.  
  479. Seal                To encipher a record containing  several
  480.                     fields  in  such  a  way that the fields
  481.                     cannot be individually replaced  without
  482.                     either  knowledge  of the encryption key
  483.                     or leaving evidence of tampering.
  484.  
  485.  
  486. Secret key          An encryption key shared by a  principal
  487.                     and  the  KDC,  distributed  outside the
  488.                     bounds of the system, with a long  life-
  489.                     time.   In  the  case  of a human user's
  490.                     principal, the  secret  key  is  derived
  491.                     from a password.
  492.  
  493.  
  494. Server              A particular Principal which provides  a
  495.                     resource to network clients.
  496.  
  497.  
  498. Service             A resource provided to network  clients;
  499.                     often  provided  by more than one server
  500.                     (for example, remote file service).
  501.  
  502.  
  503. Session key         A temporary encryption key used  between
  504.                     two  principals, with a lifetime limited
  505.                     to the duration of a single login  "ses-
  506.                     sion".
  507.  
  508.  
  509. Sub-session key     A temporary encryption key used  between
  510.                     two  principals,  selected and exchanged
  511.                     by the principals using the session key,
  512.                     and with a lifetime limited to the dura-
  513.                     tion of a single association.
  514.  
  515.  
  516. Ticket              A record that helps a  client  authenti-
  517.                     cate itself to a server; it contains the
  518.  
  519.  
  520. Section 1.3.               - 8 -    Expires 28 February 1993
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.                   Version 5 - Revision 5.1
  528.  
  529.  
  530.                     client's  identity,  a  session  key,  a
  531.                     timestamp,  and  other  information, all
  532.                     sealed using the  server's  secret  key.
  533.                     It  only serves to authenticate a client
  534.                     when  presented  along  with   a   fresh
  535.                     Authenticator.
  536.  
  537. _2.  _T_i_c_k_e_t _f_l_a_g _u_s_e_s _a_n_d _r_e_q_u_e_s_t_s
  538.  
  539. Each Kerberos ticket contains a set of flags which are  used
  540. to  indicate  various attributes of that ticket.  Most flags
  541. may be requested by a client when the  ticket  is  obtained;
  542. some  are  automatically  turned  on  and  off by a Kerberos
  543. server as required.  The following sections explain what the
  544. various  flags  mean,  and  gives examples of reasons to use
  545. such a flag.
  546.  
  547. _2._1.  _I_n_i_t_i_a_l _a_n_d _p_r_e-_a_u_t_h_e_n_t_i_c_a_t_e_d _t_i_c_k_e_t_s
  548.  
  549.      The INITIAL flag indicates that  a  ticket  was  issued
  550. using  the  AS  protocol  and  not issued based on a ticket-
  551. granting ticket.  Application servers that want  to  require
  552. the  knowledge  of  a  client's secret key (e.g. a password-
  553. changing program) can insist that this flag be  set  in  any
  554. tickets  they  accept, and thus be assured that the client's
  555. key was recently presented to the application client.
  556.  
  557.      The PRE-AUTHENT and HW-AUTHENT flags  provide  addition
  558. information  about the initial authentication, regardless of
  559. whether the current ticket was  issued  directly  (in  which
  560. case  INITIAL  will also be set) or issued on the basis of a
  561. ticket-granting ticket (in which case the  INITIAL  flag  is
  562. clear,  but the PRE-AUTHENT and HW-AUTHENT flags are carried
  563. forward from the ticket-granting ticket).
  564.  
  565. _2._2.  _I_n_v_a_l_i_d _t_i_c_k_e_t_s
  566.  
  567.      The INVALID flag indicates that a  ticket  is  invalid.
  568. Application servers must reject tickets which have this flag
  569. set.  A postdated ticket will  usually  be  issued  in  this
  570. form.   Invalid  tickets must be validated by the KDC before
  571. use, by presenting them to the KDC in a TGS request with the
  572. VALIDATE option specified.  The KDC will only validate tick-
  573. ets after their starttime has  passed.   The  validation  is
  574. required  so  that  postdated tickets which have been stolen
  575. before their starttime can be rendered  permanently  invalid
  576. (through a hot-list mechanism).
  577.  
  578. _2._3.  _R_e_n_e_w_a_b_l_e _t_i_c_k_e_t_s
  579.  
  580.      Applications may desire to hold tickets  which  can  be
  581. valid  for  long  periods of time.  However, this can expose
  582. their  credentials  to  potential  theft  for  equally  long
  583. periods,  and  those stolen credentials would be valid until
  584.  
  585.  
  586. Section 2.3.               - 9 -    Expires 28 February 1993
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.                   Version 5 - Revision 5.1
  594.  
  595.  
  596. the expiration time of the ticket(s).  Simply  using  short-
  597. lived  tickets  and  obtaining  new  ones periodically would
  598. require the client to have long-term access  to  its  secret
  599. key, an even greater risk.  Renewable tickets can be used to
  600. mitigate the consequences of theft.  Renewable tickets  have
  601. two  "expiration  times":  the  first  is  when  the current
  602. instance of the ticket expires, and the second is the latest
  603. permissible  value  for  an  individual expiration time.  An
  604. application  client  must  periodically  (i.e.   before   it
  605. expires)  present  a  renewable  ticket to the KDC, with the
  606. RENEW option set in the KDC request.  The KDC will  issue  a
  607. new  ticket  with  a  new session key and a later expiration
  608. time.  All other fields of the ticket are left unmodified by
  609. the renewal process.  When the latest permissible expiration
  610. time arrives,  the  ticket  expires  permanently.   At  each
  611. renewal,  the KDC may consult a hot-list to determine if the
  612. ticket had been reported stolen since its last  renewal;  it
  613. will  refuse  to  renew  such  stolen  tickets, and thus the
  614. usable lifetime of stolen tickets is reduced.
  615.  
  616.      The RENEWABLE flag in a ticket is normally only  inter-
  617. preted  by  the  ticket-granting service (discussed below in
  618. section 3.3).  It can  usually  be  ignored  by  application
  619. servers.   However,  some  particularly  careful application
  620. servers may wish to disallow renewable tickets.
  621.  
  622.      If a renewable ticket is not renewed by its  expiration
  623. time, the KDC will not renew the ticket.  The RENEWABLE flag
  624. is reset by default, but a client may request it be  set  by
  625. setting  the RENEWABLE option in the KRB_AS_REQ message.  If
  626. it is set, then the renew-till field in the ticket  contains
  627. the time after which the ticket may not be renewed.
  628.  
  629. _2._4.  _P_o_s_t_d_a_t_e_d _t_i_c_k_e_t_s
  630.  
  631.      Applications may occasionally need  to  obtain  tickets
  632. for  use  much  later,  e.g. a batch submission system would
  633. need tickets to be valid at the time the batch job  is  ser-
  634. viced.   However, it is dangerous to hold valid tickets in a
  635. batch queue, since they will  be  on-line  longer  and  more
  636. prone  to  theft.  Postdated tickets provide a way to obtain
  637. these tickets from the KDC at job submission  time,  but  to
  638. leave  them "dormant" until they are activated and validated
  639. by a further request of the KDC.  If  a  ticket  theft  were
  640. reported  in  the  interim, the KDC would refuse to validate
  641. the ticket, and the thief would be foiled.
  642.  
  643.      The MAY-POSTDATE flag in  a  ticket  is  normally  only
  644. interpreted  by  the  ticket-granting  service.  It  can  be
  645. ignored by application servers.  This flag must be set in  a
  646. ticket-granting  ticket in order to issue a postdated ticket
  647. based on the presented ticket.  It is reset by  default;  it
  648. may  be  requested by a client by setting the ALLOW-POSTDATE
  649. option in the KRB_AS_REQ message.  This flag does not  allow
  650.  
  651.  
  652. Section 2.4.               - 10 -   Expires 28 February 1993
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.                   Version 5 - Revision 5.1
  660.  
  661.  
  662. a client to obtain a postdated ticket-granting ticket; post-
  663. dated  ticket-granting  tickets  can  only  by  obtained  by
  664. requesting  the  postdating  in the KRB_AS_REQ message.  The
  665. life (endtime-starttime) of a postdated ticket will  be  the
  666. remaining  life of the ticket-granting ticket at the time of
  667. the request, unless the RENEWABLE option  is  also  set,  in
  668. which  case  it  can be the full life (endtime-starttime) of
  669. the ticket-granting ticket.  The KDC may limit  how  far  in
  670. the future a ticket may be postdated.
  671.  
  672.      The POSTDATED flag indicates that  a  ticket  has  been
  673. postdated.   The  application  server can check the authtime
  674. field in the ticket to see when the original  authentication
  675. occurred.   Some  services  may  choose  to reject postdated
  676. tickets, or they may  only  accept  them  within  a  certain
  677. period  after  the  original  authentication.   When the KDC
  678. issues a  POSTDATED  ticket,  it  will  also  be  marked  as
  679. INVALID,  so  that  the  application client must present the
  680. ticket to the KDC to be validated before use.
  681.  
  682. _2._5.  _P_r_o_x_i_a_b_l_e _a_n_d _p_r_o_x_y _t_i_c_k_e_t_s
  683.  
  684.      At times it may be necessary for a principal to allow a
  685. service  to perform an operation on its behalf.  The service
  686. must be able to take on the identity of the client, but only
  687. for  a  particular purpose.  A principal can allow a service
  688. to take on the principal's identity for a particular purpose
  689. by granting it a proxy.
  690.  
  691.      The PROXIABLE flag in a ticket is normally only  inter-
  692. preted  by the ticket-granting service. It can be ignored by
  693. application servers.  When set, this flag tells the  ticket-
  694. granting server that it is OK to issue a new ticket (but not
  695. a ticket-granting ticket) with a different  network  address
  696. based on this ticket.  This flag is set by default.
  697.  
  698.      This flag allows a client to pass a proxy to  a  server
  699. to perform a remote request on its behalf, e.g. a print ser-
  700. vice client can give the print server a proxy to access  the
  701. client's  files  on  a  particular  file  server in order to
  702. satisfy a print request.
  703.  
  704.      In order to complicate the use of  stolen  credentials,
  705. Kerberos  tickets  are usually valid from only those network
  706. addresses specifically included in the ticket[4].  For  this
  707. reason, a client wishing to grant a proxy must request a new
  708. ticket valid for the network address of the  service  to  be
  709. granted the proxy.
  710. __________________________
  711. [4] It is permissible to request or issue tickets  with
  712. no network addresses specified, but we do not recommend
  713. it.
  714.  
  715.  
  716.  
  717. Section 2.5.               - 11 -   Expires 28 February 1993
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.                   Version 5 - Revision 5.1
  725.  
  726.  
  727.      The PROXY flag is set in a ticket by the  TGS  when  it
  728. issues  a  proxy ticket.  Application servers may check this
  729. flag and require additional authentication  from  the  agent
  730. presenting the proxy in order to provide an audit trail.
  731.  
  732. _2._6.  _F_o_r_w_a_r_d_a_b_l_e _t_i_c_k_e_t_s
  733.  
  734.      Authentication forwarding is an instance of  the  proxy
  735. case  where  the  service  is  granted  complete  use of the
  736. client's identity.  An example where it  might  be  used  is
  737. when a user logs in to a remote system and wants authentica-
  738. tion to work from that system as if the login were local.
  739.  
  740.      The FORWARDABLE flag  in  a  ticket  is  normally  only
  741. interpreted  by  the  ticket-granting  service.   It  can be
  742. ignored by application servers.  The FORWARDABLE flag has an
  743. interpretation similar to that of the PROXIABLE flag, except
  744. ticket-granting tickets may also be  issued  with  different
  745. network addresses.  This flag is reset by default, but users
  746. may request that it be set by setting the FORWARDABLE option
  747. in  the  AS  request when they request their initial ticket-
  748. granting ticket.
  749.  
  750.      This flag allows for authentication forwarding  without
  751. requiring  the  user to enter a password again.  If the flag
  752. is not set, then authentication forwarding is not permitted,
  753. but  the  same  end result can still be achieved if the user
  754. engages in  the  AS  exchange  with  the  requested  network
  755. addresses and supplies a password.
  756.  
  757.      The FORWARDED flag is set by  the  TGS  when  a  client
  758. presents a ticket with the FORWARDABLE flag set and requests
  759. it be set by specifying the FORWARDED KDC option and supply-
  760. ing  a  set of addresses for the new ticket.  It is also set
  761. in all tickets issued based on tickets  with  the  FORWARDED
  762. flag set.  Application servers may wish to process FORWARDED
  763. tickets differently than non-FORWARDED tickets.
  764.  
  765. _2._7.  _O_t_h_e_r _K_D_C _o_p_t_i_o_n_s
  766.  
  767.      There are two additional options which may be set in  a
  768. client's request of the KDC.
  769.  
  770.      The RENEWABLE-OK option indicates that the client  will
  771. accept  a  renewable  ticket  if a ticket with the requested
  772. life cannot otherwise be provided.  If  a  ticket  with  the
  773. requested  life cannot be provided, then the KDC may issue a
  774. renewable  ticket  with  a  renew-till  equal  to  the   the
  775. requested  endtime.   The  value of the renew-till field may
  776. still  be  adjusted  by  site-determined  limits  or  limits
  777. imposed by the individual principal or server.
  778.  
  779.      The ENC-TKT-IN-SKEY  option  is  honored  only  by  the
  780. ticket-granting service.  It indicates that the to-be-issued
  781.  
  782.  
  783. Section 2.7.               - 12 -   Expires 28 February 1993
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.                   Version 5 - Revision 5.1
  791.  
  792.  
  793. ticket for the end server is to be encrypted in the  session
  794. key from the additional ticket-granting ticket provided with
  795. the request.  See section 3.3.3 for specific details.
  796.  
  797. _3.  _M_e_s_s_a_g_e _E_x_c_h_a_n_g_e_s
  798.  
  799. The following sections  describe  the  interactions  between
  800. network  clients  and  servers  and the messages involved in
  801. those exchanges.
  802.  
  803. _3._1.  _T_h_e _A_u_t_h_e_n_t_i_c_a_t_i_o_n _S_e_r_v_i_c_e _E_x_c_h_a_n_g_e
  804.  
  805.                           Summary
  806.       _M_e_s_s_a_g_e _d_i_r_e_c_t_i_o_n       _M_e_s_s_a_g_e _t_y_p_e    _S_e_c_t_i_o_n
  807.       1. Client to Kerberos   KRB_AS_REQ      5.4.1
  808.       2. Kerberos to client   KRB_AS_REP or   5.4.2
  809.                               KRB_ERROR       5.8.1
  810.  
  811.  
  812.      The Authentication Service (AS)  Exchange  between  the
  813. client and the Kerberos Authentication Server is usually in-
  814. itiated by a client when it wishes to obtain  authentication
  815. credentials  for  a  given  server  but  currently  holds no
  816. credentials.  The client's secret key is used for encryption
  817. and decryption.  This exchange is typically used at the ini-
  818. tiation of a login session,  to  obtain  credentials  for  a
  819. Ticket-Granting  Server,  which will subsequently be used to
  820. obtain credentials  for  other  servers  (see  section  3.3)
  821. without  requiring  further  use of the client's secret key.
  822. This exchange is also used to request credentials  for  ser-
  823. vices which must not be mediated through the Ticket-Granting
  824. Service, but rather require a principal's secret  key,  such
  825. as the password-changing service[5].
  826.  
  827.      The exchange consists of two messages: KRB_AS_REQ  from
  828. the  client  to  Kerberos,  and  KRB_AS_REP  or KRB_ERROR in
  829. reply.  The formats for these messages are described in sec-
  830. tions 5.4.1, 5.4.2, and 5.8.1.
  831.  
  832.      In the request, the client sends (in cleartext) its own
  833. identity  and  the  identity  of  the server for which it is
  834. requesting credentials.  The response, KRB_AS_REP,  contains
  835. a ticket for the client to present to the server, and a ses-
  836. sion key that will be shared by the client and  the  server.
  837. The  session key and additional information are encrypted in
  838. the client's secret key.  The  KRB_AS_REP  message  contains
  839. information  which  can  be  used  to detect replays, and to
  840. __________________________
  841. [5] The password-changing request must not  be  honored
  842. unless  the requester can provide the old password (the
  843. user's current secret key).   Otherwise,  it  would  be
  844. possible  for  someone to walk up to an unattended ses-
  845. sion and change another user's password.
  846.  
  847. Section 3.1.               - 13 -   Expires 28 February 1993
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.                   Version 5 - Revision 5.1
  855.  
  856.  
  857. associate it with the message to which it replies.   Various
  858. errors  can  occur; these are indicated by an error response
  859. (KRB_ERROR) instead of the KRB_AS_REP response.   The  error
  860. message  is  not encrypted.  The KRB_ERROR message also con-
  861. tains information which can be used to associate it with the
  862. message  to which it replies.  The lack of encryption in the
  863. KRB_ERROR message precludes the ability to detect replays or
  864. fabrications of such messages.
  865.  
  866.      In the normal case the authentication server  does  not
  867. know  whether  the client is actually the principal named in
  868. the request.  It simply sends a  reply  without  knowing  or
  869. caring  whether  they  are  the  same.   This  is acceptable
  870. because nobody but the principal whose identity was given in
  871. the  request  will  be  able  to use the reply. Its critical
  872. information is encrypted in that principal's key.  The  ini-
  873. tial  request supports an optional field that can be used to
  874. pass additional information that might  be  needed  for  the
  875. initial   exchange.    This  field  may  be  used  for  pre-
  876. authentication  if  desired,  but  the  mechanism   is   not
  877. currently specified.
  878.  
  879. _3._1._1.  _G_e_n_e_r_a_t_i_o_n _o_f _K_R_B__A_S__R_E_Q _m_e_s_s_a_g_e
  880.  
  881.      The client may specify a number of options in the  ini-
  882. tial request.  Among these options are whether the requested
  883. ticket  is  to  be  renewable,  proxiable,  or  forwardable;
  884. whether  it  should  be  postdated  or  allow  postdating of
  885. derivative tickets; and whether a renewable ticket  will  be
  886. accepted  in lieu of a non-renewable ticket if the requested
  887. ticket  expiration  date  cannot  be  satisfied  by  a  non-
  888. renewable ticket (due to configuration constraints; see sec-
  889. tion 4).  See section A.1 for pseudocode.
  890.  
  891.      The client prepares the KRB_AS_REQ message and sends it
  892. to the KDC.
  893.  
  894. _3._1._2.  _R_e_c_e_i_p_t _o_f _K_R_B__A_S__R_E_Q _m_e_s_s_a_g_e
  895.  
  896.      If all goes well,  processing  the  KRB_AS_REQ  message
  897. will  result  in  the creation of a ticket for the client to
  898. present to  the  server.   The  format  for  the  ticket  is
  899. described  in section 5.3.1.  The contents of the ticket are
  900. determined as follows.
  901.  
  902. _3._1._3.  _G_e_n_e_r_a_t_i_o_n _o_f _K_R_B__A_S__R_E_P _m_e_s_s_a_g_e
  903.  
  904.      The authentication  server  looks  up  the  client  and
  905. server  principals  named in the KRB_AS_REQ in its database,
  906. extracting their respective  keys.   If  the  server  cannot
  907. accommodate  the requested encryption type, an error message
  908. with code KDC_ERR_ETYPE_NOSUPP is  returned.   Otherwise  it
  909. generates a "random" session key[6].
  910. __________________________
  911.  
  912.  
  913. Section 3.1.3.             - 14 -   Expires 28 February 1993
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.                   Version 5 - Revision 5.1
  921.  
  922.  
  923.      If the requested start time is absent  or  indicates  a
  924. time  in  the past, then the start time of the ticket is set
  925. to the authentication server's current time. If it indicates
  926. a  time in the future, but the POSTDATED option has not been
  927. specified,  then  the   error   KDC_ERR_CANNOT_POSTDATE   is
  928. returned.   Otherwise  the  requested  start time is checked
  929. against the policy of the  local  realm  (the  administrator
  930. might  decide  to  prohibit certain types or ranges of post-
  931. dated tickets), and if acceptable, the ticket's  start  time
  932. is  set as requested and  the INVALID flag is set in the new
  933. ticket. The postdated ticket must be validated before use by
  934. presenting  it  to  the  KDC  after  the start time has been
  935. reached.
  936.  
  937. The expiration time of the ticket will be set to the minimum
  938. of the following:
  939.  
  940. o+The expiration time (endtime) requested in  the  KRB_AS_REQ
  941.  message.
  942.  
  943. o+The ticket's start time plus the maximum allowable lifetime
  944.  associated  with  the  client principal (the authentication
  945.  server's database includes a maximum ticket lifetime  field
  946.  in each principal's record; see section 4).
  947.  
  948. o+The ticket's start time plus the maximum allowable lifetime
  949.  associated with the server principal.
  950.  
  951. o+The ticket's start time plus the maximum  lifetime  set  by
  952.  the policy of the local realm.
  953.  
  954.      If the requested expiration time minus the  start  time
  955. (as determined above) is less than a site-determined minimum
  956. lifetime, an error message with code KDC_ERR_NEVER_VALID  is
  957. returned.   If  the requested expiration time for the ticket
  958. exceeds  what  was  determined  as   above,   and   if   the
  959. "RENEWABLE-OK"  option  was  requested, then the "RENEWABLE"
  960. flag is set in the new ticket, and the renew-till  value  is
  961. set  as  if the "RENEWABLE" option were requested (the field
  962. and option names are described fully in section 5.4.1).
  963.  
  964.  
  965.  
  966.  
  967. __________________________
  968. [6] "Random" means that, among other things, it  should
  969. be  impossible  to  guess the next session key based on
  970. knowledge of past  session  keys.   This  can  only  be
  971. achieved  in  a pseudo-random number generator if it is
  972. based on cryptographic principles.  It  would  be  more
  973. desirable  to use a truly random number generator, such
  974. as  one  based  on  measurements  of  random   physical
  975. phenomena.
  976.  
  977.  
  978.  
  979. Section 3.1.3.             - 15 -   Expires 28 February 1993
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.                   Version 5 - Revision 5.1
  987.  
  988.  
  989. If the  RENEWABLE  option  has  been  requested  or  if  the
  990. RENEWABLE-OK  option  has been set and a renewable ticket is
  991. to be issued, then  the  renew-till  field  is  set  to  the
  992. minimum of:
  993.  
  994. o+Its requested value.
  995.  
  996. o+The start time of the ticket plus the minimum  of  the  two
  997.  maximum renewable lifetimes associated with the principals'
  998.  database entries.
  999.  
  1000. o+The start time of the ticket  plus  the  maximum  renewable
  1001.  lifetime set by the policy of the local realm.
  1002.  
  1003.      The flags field of the new ticket will have the follow-
  1004. ing  options set if they have been requested and if the pol-
  1005. icy of the local realm  allows:  FORWARDABLE,  MAY-POSTDATE,
  1006. POSTDATED,  PROXIABLE, RENEWABLE. If the new ticket is post-
  1007. dated (the start time is in the future),  its  INVALID  flag
  1008. will also be set.
  1009.  
  1010.      If all of the  above  succeed,  the  server  formats  a
  1011. KRB_AS_REP   message   (see   section  5.4.2),  copying  the
  1012. addresses in the request into the  caddr  of  the  response,
  1013. placing any required pre-authentication data into the padata
  1014. of the response, and encrypts the  ciphertext  part  in  the
  1015. client's  key  using  the  requested  encryption method, and
  1016. sends it to the client.  See section A.2 for pseudocode.
  1017.  
  1018. _3._1._4.  _G_e_n_e_r_a_t_i_o_n _o_f _K_R_B__E_R_R_O_R _m_e_s_s_a_g_e
  1019.  
  1020.      Several errors can occur, and the Authentication Server
  1021. responds  by  returning  an error message, KRB_ERROR, to the
  1022. client,  with  the  error-code  and  e-text  fields  set  to
  1023. appropriate  values.  The error message contents and details
  1024. are described in Section 5.8.1.
  1025.  
  1026. _3._1._5.  _R_e_c_e_i_p_t _o_f _K_R_B__A_S__R_E_P _m_e_s_s_a_g_e
  1027.  
  1028.      If the reply  message  type  is  KRB_AS_REP,  then  the
  1029. client  verifies  that  the  cname  and crealm fields in the
  1030. cleartext portion of the reply match what it requested.   If
  1031. any  padata  fields  are present, they may be used to derive
  1032. the proper secret key to decrypt the  message.   The  client
  1033. decrypts the encrypted part of the response using its secret
  1034. key, verifies that the nonce in the encrypted  part  matches
  1035. the  nonce  it  supplied in its request (to detect replays).
  1036. It also verifies that the sname and srealm in  the  response
  1037. match  those in the request, and that the host address field
  1038. is also correct.  It then stores the  ticket,  session  key,
  1039. start  and expiration times, and other information for later
  1040. use.  The key-expiration field from the  encrypted  part  of
  1041. the  response may be checked to notify the user of impending
  1042. key  expiration  (the  client  program  could  then  suggest
  1043.  
  1044.  
  1045. Section 3.1.5.             - 16 -   Expires 28 February 1993
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.                   Version 5 - Revision 5.1
  1053.  
  1054.  
  1055. remedial  action,  such  as a password change).  See section
  1056. A.3 for pseudocode.
  1057.  
  1058.      Proper decryption of the KRB_AS_REP message is _n_o_t suf-
  1059. ficient  to verify the identity of the user; the user and an
  1060. attacker could cooperate to  generate  a  KRB_AS_REP  format
  1061. message  which  decrypts properly but is not from the proper
  1062. KDC.  If the host wishes to verify the identity of the user,
  1063. it  must require the user to present application credentials
  1064. which can be verified using a  securely-stored  secret  key.
  1065. If  those  credentials can be verified, then the identity of
  1066. the user can be assured.
  1067.  
  1068. _3._1._6.  _R_e_c_e_i_p_t _o_f _K_R_B__E_R_R_O_R _m_e_s_s_a_g_e
  1069.  
  1070.      If the reply message type is KRB_ERROR, then the client
  1071. interprets   it   as   an   error   and   performs  whatever
  1072. application-specific tasks are necessary to recover.
  1073.  
  1074. _3._2.  _T_h_e _C_l_i_e_n_t/_S_e_r_v_e_r _A_u_t_h_e_n_t_i_c_a_t_i_o_n _E_x_c_h_a_n_g_e
  1075.  
  1076.                              Summary
  1077. _M_e_s_s_a_g_e _d_i_r_e_c_t_i_o_n                         _M_e_s_s_a_g_e _t_y_p_e    _S_e_c_t_i_o_n
  1078. Client to Application server              KRB_AP_REQ      5.5.1
  1079. [optional] Application server to client   KRB_AP_REP or   5.5.2
  1080.                                           KRB_ERROR       5.8.1
  1081.  
  1082.  
  1083.      The client/server authentication (CS) exchange is  used
  1084. by  network  applications  to authenticate the client to the
  1085. server  and  vice  versa.   The  client  must  have  already
  1086. acquired  credentials  for  the  server  using the AS or TGS
  1087. exchange.
  1088.  
  1089. _3._2._1.  _T_h_e _K_R_B__A_P__R_E_Q _m_e_s_s_a_g_e
  1090.  
  1091.      The  KRB_AP_REQ  contains  authentication   information
  1092. which  should  be  part of the first message in an authenti-
  1093. cated transaction.  It contains a ticket, an  authenticator,
  1094. and  some  additional  bookkeeping  information (see section
  1095. 5.5.1 for the exact format).  The ticket by itself is insuf-
  1096. ficient  to  authenticate a client, since tickets are passed
  1097. across the network in cleartext[7], so the authenticator  is
  1098. used  to prevent invalid replay of tickets by proving to the
  1099. server that the client knows the session key of  the  ticket
  1100. and  thus  is entitled to use it.  The KRB_AP_REQ message is
  1101. referred to elsewhere as the "authentication header."
  1102. __________________________
  1103. [7] Tickets contain both an encrypted  and  unencrypted
  1104. portion,  so  cleartext here refers to the entire unit,
  1105. which can be copied from one message  and  replayed  in
  1106. another without any cryptographic skill.
  1107.  
  1108.  
  1109.  
  1110. Section 3.2.1.             - 17 -   Expires 28 February 1993
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.                   Version 5 - Revision 5.1
  1118.  
  1119.  
  1120. _3._2._2.  _G_e_n_e_r_a_t_i_o_n _o_f _a _K_R_B__A_P__R_E_Q _m_e_s_s_a_g_e
  1121.  
  1122.      When a client wishes to initiate  authentication  to  a
  1123. server,  it obtains (either through a credentials cache, the
  1124. AS exchange, or the TGS exchange) a ticket and  session  key
  1125. for  the desired service.  The client may re-use any tickets
  1126. it holds until they expire.  The client  then  constructs  a
  1127. new  Authenticator  from  the the system time, its name, and
  1128. optionally an  application  specific  checksum,  an  initial
  1129. sequence number to be used in KRB_SAFE or KRB_PRIV messages,
  1130. and/or a session subkey to be used  in  negotiations  for  a
  1131. session  key unique to this particular session.  Authentica-
  1132. tors may not be re-used and will be rejected if replayed  to
  1133. a server[8].  If a sequence number is  to  be  included,  it
  1134. should  be  randomly chosen so that even after many messages
  1135. have been exchanged it is not likely to collide  with  other
  1136. sequence numbers in use.
  1137.  
  1138.      The client may indicate a requirement of mutual authen-
  1139. tication or the use of a session-key based ticket by setting
  1140. the appropriate flag(s) in the ap-options field of the  mes-
  1141. sage.
  1142.  
  1143.      The Authenticator is encrypted in the session  key  and
  1144. combined  with  the  ticket  to  form the KRB_AP_REQ message
  1145. which is then sent to the end server along  with  any  addi-
  1146. tional  application-specific  information.   See section A.9
  1147. for pseudocode.
  1148.  
  1149. _3._2._3.  _R_e_c_e_i_p_t _o_f _K_R_B__A_P__R_E_Q _m_e_s_s_a_g_e
  1150.  
  1151.      Authentication is based on the server's current time of
  1152. day  (clocks  must be loosely synchronized), the authentica-
  1153. tor, and the ticket.  Several errors are  possible.   If  an
  1154. error  occurs, the server is expected to reply to the client
  1155. with a KRB_ERROR message.  This message may be  encapsulated
  1156. in the application protocol if its "raw" form is not accept-
  1157. able to the protocol.   The  format  of  error  messages  is
  1158. described in section 5.8.1.
  1159.  
  1160.      The algorithm for verifying authentication  information
  1161. is  as  follows.  If the message type is not KRB_AP_REQ, the
  1162. server returns the KRB_AP_ERR_MSG_TYPE error.   If  the  key
  1163. version indicated by the Ticket in the KRB_AP_REQ is not one
  1164. the server can use (e.g., it indicates an old key,  and  the
  1165. server  no  longer  possesses  a  copy  of the old key), the
  1166. KRB_AP_ERR_BADKEYVER  error  is  returned.   If   the   USE-
  1167. __________________________
  1168. [8] Note that this can make applications based  on  un-
  1169. reliable transports difficult to code correctly, if the
  1170. transport might deliver duplicated messages.   In  such
  1171. cases,  a  new authenticator must be generated for each
  1172. retry.
  1173.  
  1174. Section 3.2.3.             - 18 -   Expires 28 February 1993
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.                   Version 5 - Revision 5.1
  1182.  
  1183.  
  1184. SESSION-KEY flag is set in the ap-options  field,  it  indi-
  1185. cates to the server that the ticket is encrypted in the ses-
  1186. sion key from the  server's  ticket-granting  ticket  rather
  1187. than its secret key[9].  Since it is possible for the server
  1188. to  be registered in multiple realms, with different keys in
  1189. each, the srealm field in the  unencrypted  portion  of  the
  1190. ticket in the KRB_AP_REQ is used to specify which secret key
  1191. the  server  should  use  to  decrypt  that   ticket.    The
  1192. KRB_AP_ERR_NOKEY  error  code  is  returned  if  the  server
  1193. doesn't have the proper key to decipher the ticket.
  1194.  
  1195.      The ticket  is  decrypted  using  the  version  of  the
  1196. server's  key  specified  by  the ticket.  If the decryption
  1197. routines detect a modification of the ticket  (each  encryp-
  1198. tion  system  must  provide  safeguards  to  detect modified
  1199. ciphertext; see  section  6),  the  KRB_AP_ERR_BAD_INTEGRITY
  1200. error is returned (chances are good that different keys were
  1201. used to encrypt and decrypt).
  1202.  
  1203.      The authenticator is decrypted using  the  session  key
  1204. extracted from the decrypted ticket.  If decryption shows it
  1205. to have been modified, the KRB_AP_ERR_BAD_INTEGRITY error is
  1206. returned.   The name and realm of the client from the ticket
  1207. are compared against the same fields in  the  authenticator.
  1208. If  they  don't  match,  the  KRB_AP_ERR_BADMATCH  error  is
  1209. returned (they might not match, for example,  if  the  wrong
  1210. session  key  was  used  to encrypt the authenticator).  The
  1211. addresses in the ticket (if any) are then  searched  for  an
  1212. address  matching  the  operating-system reported address of
  1213. the client.  If no match is found or the server  insists  on
  1214. ticket  addresses  but  none  are present in the ticket, the
  1215. KRB_AP_ERR_BADADDR error is returned.
  1216.  
  1217.      If the local (server) time and the client time  in  the
  1218. authenticator  differ  by more than the allowable clock skew
  1219. (e.g., 5 minutes), the KRB_AP_ERR_SKEW  error  is  returned.
  1220. If  the  server  name,  along with the client name, time and
  1221. microsecond  fields  from  the   Authenticator   match   any
  1222. recently-seen  such  tuples,  the KRB_AP_ERR_REPEAT error is
  1223. returned[10].  The server must  remember  any  authenticator
  1224. presented  within the allowable clock skew, so that a replay
  1225. attempt is guaranteed to fail.  If a server loses  track  of
  1226. any authenticator presented within the allowable clock skew,
  1227. __________________________
  1228. [9] This is used  for  user-to-user  authentication  as
  1229. described in  [6].
  1230. [10] Note that the rejection here is restricted to  au-
  1231. thenticators  from  the  same  principal  to  the  same
  1232. server.  Other client principals communicating with the
  1233. same  server principal should not be have their authen-
  1234. ticators rejected if the time  and  microsecond  fields
  1235. happen to match some other client's authenticator.
  1236.  
  1237.  
  1238.  
  1239. Section 3.2.3.             - 19 -   Expires 28 February 1993
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.                   Version 5 - Revision 5.1
  1247.  
  1248.  
  1249. it must reject all requests until the  clock  skew  interval
  1250. has passed.  This assures that any lost or re-played authen-
  1251. ticators will fall outside the allowable clock skew and  can
  1252. no  longer be successfully replayed (If this is not done, an
  1253. attacker could conceivably record the ticket and authentica-
  1254. tor  sent  over  the  network  to a server, then disable the
  1255. client's host, pose as the disabled  host,  and  replay  the
  1256. ticket  and  authenticator  to subvert the authentication.).
  1257. If a sequence number is provided in the  authenticator,  the
  1258. server  saves it for later use in processing KRB_SAFE and/or
  1259. KRB_PRIV messages.  If  a  subkey  is  present,  the  server
  1260. either  saves  it  for later use or uses it to help generate
  1261. its own choice for a subkey to be returned in  a  KRB_AP_REP
  1262. message.
  1263.  
  1264.      The server  computes  the  age  of  the  ticket:  local
  1265. (server)  time  minus  the start time inside the Ticket.  If
  1266. the start time is later than the current time by  more  than
  1267. the  allowable  clock  skew or if the INVALID flag is set in
  1268. the ticket, the KRB_AP_ERR_TKT_NYV error is returned.   Oth-
  1269. erwise,  if  the current time is later than end time by more
  1270. than the allowable clock  skew,  the  KRB_AP_ERR_TKT_EXPIRED
  1271. error is returned.
  1272.  
  1273.      If all these  checks  succeed  without  an  error,  the
  1274. server  is assured that the client possesses the credentials
  1275. of the principal named in the ticket and  thus,  the  client
  1276. has  been authenticated to the server.  See section A.10 for
  1277. pseudocode.
  1278.  
  1279. _3._2._4.  _G_e_n_e_r_a_t_i_o_n _o_f _a _K_R_B__A_P__R_E_P _m_e_s_s_a_g_e
  1280.  
  1281.      Typically, a client's request  will  include  both  the
  1282. authentication  information  and  its initial request in the
  1283. same message, and the server need not  explicitly  reply  to
  1284. the KRB_AP_REQ.  However, if mutual authentication (not only
  1285. authenticating the client to the server, but also the server
  1286. to  the  client)  is being performed, the KRB_AP_REQ message
  1287. will have MUTUAL-REQUIRED set in its ap-options field, and a
  1288. KRB_AP_REP  message  is  required  in response.  As with the
  1289. error message, this  message  may  be  encapsulated  in  the
  1290. application  protocol if its "raw" form is not acceptable to
  1291. the application's protocol.  The timestamp  and  microsecond
  1292. field  used  in the reply must be the client's timestamp and
  1293. microsecond field (as provided  in  the  authenticator)[11].
  1294. __________________________
  1295. [11] In the Kerberos version 4 protocol, the  timestamp
  1296. in the reply was the client's timestamp plus one.  This
  1297. is not necessary in version 5 because  version  5  mes-
  1298. sages are formatted in such a way that it is not possi-
  1299. ble to create the reply by  judicious  message  surgery
  1300. (even  in  encrypted form) without knowledge of the ap-
  1301. propriate encryption keys.
  1302.  
  1303. Section 3.2.4.             - 20 -   Expires 28 February 1993
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.                   Version 5 - Revision 5.1
  1311.  
  1312.  
  1313. If a sequence number is to be included, it  should  be  ran-
  1314. domly  chosen  as  described above for the authenticator.  A
  1315. subkey may be included if the server desires to negotiate  a
  1316. different  subkey.   The  KRB_AP_REP message is encrypted in
  1317. the session key extracted from the ticket.  See section A.11
  1318. for pseudocode.
  1319.  
  1320. _3._2._5.  _R_e_c_e_i_p_t _o_f _K_R_B__A_P__R_E_P _m_e_s_s_a_g_e
  1321.  
  1322.  
  1323.      If a KRB_AP_REP message is returned,  the  client  uses
  1324. the  session  key  from  the  credentials  obtained  for the
  1325. server[12] to decrypt the message,  and  verifies  that  the
  1326. timestamp  and microsecond fields match those in the Authen-
  1327. ticator it sent to the server.   If  they  match,  then  the
  1328. client  is assured that the server is genuine.  The sequence
  1329. number and subkey (if present) are retained for  later  use.
  1330. See section A.12 for pseudocode.
  1331.  
  1332.  
  1333. _3._2._6.  _U_s_i_n_g _t_h_e _e_n_c_r_y_p_t_i_o_n _k_e_y
  1334.  
  1335.      After the KRB_AP_REQ/KRB_AP_REP exchange has  occurred,
  1336. the  client  and server share an encryption key which can be
  1337. used by the application.  The "true session key" to be  used
  1338. for  KRB_PRIV,  KRB_SAFE, or other application-specific uses
  1339. may be chosen by the application based on the subkeys in the
  1340. KRB_AP_REP  message  and  the  authenticator[13].   In  some
  1341. cases,  the  use of this session key will be implicit in the
  1342. protocol; in others the method of use must be chosen from  a
  1343. several alternatives.  We leave the protocol negotiations of
  1344. how to use the key (e.g.  selecting an encryption or  check-
  1345. sum type) to the application programmer; the Kerberos proto-
  1346. col does not constrain the implementation options.
  1347.  
  1348.      With  both  the  one-way  and   mutual   authentication
  1349. exchanges,  the peers should take care not to send sensitive
  1350. information to each other  without  proper  assurances.   In
  1351. particular,  applications  that require privacy or integrity
  1352. should use the KRB_AP_REP or KRB_ERROR  responses  from  the
  1353. server  to  client to assure both client and server of their
  1354. peer's  identity.   If  an  application  protocol   requires
  1355. privacy  of  its  messages,  it can use the KRB_PRIV message
  1356. (section 3.5).  The KRB_SAFE message (section  3.4)  can  be
  1357. __________________________
  1358. [12] Note that for encrypting the  KRB_AP_REP  message,
  1359. the sub-session key is not used, even if present in the
  1360. Authenticator.
  1361. [13] Implementations  of  the protocol may wish to pro-
  1362. vide routines to choose subkeys based on  session  keys
  1363. and  random numbers and to orchestrate a negotiated key
  1364. to be returned in the KRB_AP_REP message.
  1365.  
  1366.  
  1367.  
  1368. Section 3.2.6.             - 21 -   Expires 28 February 1993
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.                   Version 5 - Revision 5.1
  1376.  
  1377.  
  1378. used to assure integrity.
  1379.  
  1380.  
  1381. _3._3.  _T_h_e _T_i_c_k_e_t-_G_r_a_n_t_i_n_g _S_e_r_v_i_c_e (_T_G_S) _E_x_c_h_a_n_g_e
  1382.  
  1383.                           Summary
  1384.       _M_e_s_s_a_g_e _d_i_r_e_c_t_i_o_n       _M_e_s_s_a_g_e _t_y_p_e     _S_e_c_t_i_o_n
  1385.       1. Client to Kerberos   KRB_TGS_REQ      5.4.1
  1386.       2. Kerberos to client   KRB_TGS_REP or   5.4.2
  1387.                               KRB_ERROR        5.8.1
  1388.  
  1389.  
  1390.      The TGS exchange between  a  client  and  the  Kerberos
  1391. Ticket-Granting  Server  is  initiated  by  a client when it
  1392. wishes to obtain  authentication  credentials  for  a  given
  1393. server  (which  might be registered in a remote realm), when
  1394. it wishes to renew or validate an existing ticket,  or  when
  1395. it  wishes to obtain a proxy ticket.  In the first case, the
  1396. client must already have acquired a ticket for  the  Ticket-
  1397. Granting  Service using the AS exchange (the ticket-granting
  1398. ticket is usually obtained when a client initially authenti-
  1399. cates to the system, such as when a user logs in).  The mes-
  1400. sage format for the TGS exchange is almost identical to that
  1401. for the AS exchange.  The primary difference is that encryp-
  1402. tion and decryption in the TGS exchange does not take  place
  1403. under  the  client's key.  Instead, the session key from the
  1404. ticket-granting ticket or renewable ticket,  or  sub-session
  1405. key  from  an Authenticator is used.  As is the case for all
  1406. application servers, expired tickets are not accepted by the
  1407. TGS,  so once a renewable or ticket-granting ticket expires,
  1408. the client must use a  separate  exchange  to  obtain  valid
  1409. tickets.
  1410.  
  1411.      The TGS exchange consists of two  messages:  A  request
  1412. (KRB_TGS_REQ)  from  the  client  to  the  Kerberos  Ticket-
  1413. Granting Server, and a  reply  (KRB_TGS_REP  or  KRB_ERROR).
  1414. The  KRB_TGS_REQ message includes information authenticating
  1415. the client plus a request for credentials.  The  authentica-
  1416. tion  information  consists  of  the  authentication  header
  1417. (KRB_AP_REQ) which includes the client's previously obtained
  1418. ticket-granting,  renewable,  or  invalid  ticket.   In  the
  1419. ticket-granting ticket and  proxy  cases,  the  request  may
  1420. include  one or more of: a list of network addresses, a col-
  1421. lection of typed authorization data  to  be  sealed  in  the
  1422. ticket  for  authorization use by the application server, or
  1423. additional tickets (the use of which are  described  later).
  1424. The  TGS  reply (KRB_TGS_REP) contains the requested creden-
  1425. tials, encrypted in the session key from the ticket-granting
  1426. ticket  or  renewable  ticket,  or  if  present, in the sub-
  1427. session key from the Authenticator (part of the  authentica-
  1428. tion  header).  The KRB_ERROR message contains an error code
  1429. and text explaining what went wrong.  The KRB_ERROR  message
  1430. is not encrypted.  The KRB_TGS_REP message contains informa-
  1431. tion which can be used to detect replays, and  to  associate
  1432.  
  1433.  
  1434. Section 3.3.               - 22 -   Expires 28 February 1993
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.                   Version 5 - Revision 5.1
  1442.  
  1443.  
  1444. it with the message to which it replies.  The KRB_ERROR mes-
  1445. sage also contains information which can be used to  associ-
  1446. ate it with the message to which it replies, but the lack of
  1447. encryption in the KRB_ERROR message precludes the ability to
  1448. detect replays or fabrications of such messages.
  1449.  
  1450. _3._3._1.  _G_e_n_e_r_a_t_i_o_n _o_f _K_R_B__T_G_S__R_E_Q _m_e_s_s_a_g_e
  1451.  
  1452.      Before sending a request to  the  ticket-granting  ser-
  1453. vice,  the client must determine in which realm the applica-
  1454. tion server is  registered[14].   If  the  client  does  not
  1455. already possess a ticket-granting ticket for the appropriate
  1456. realm, then one must be obtained.  This is  first  attempted
  1457. by  requesting  a ticket-granting ticket for the destination
  1458. realm from the local Kerberos server (using the  KRB_TGS_REQ
  1459. message  recursively).  The Kerberos server may return a TGT
  1460. for the desired realm in which case one can proceed.  Alter-
  1461. natively,  the  Kerberos server may return a TGT for a realm
  1462. which is "closer" to the desired realm  (further  along  the
  1463. standard hierarchical path), in which case this step must be
  1464. repeated with a Kerberos server in the  realm  specified  in
  1465. the returned TGT.  If neither are returned, then the request
  1466. must be retried with a Kerberos server for a realm higher in
  1467. the  hierarchy.   This request will itself require a ticket-
  1468. granting ticket for the higher realm which must be  obtained
  1469. by recursively applying these directions.
  1470.  
  1471.  
  1472.      Once the client obtains a  ticket-granting  ticket  for
  1473. the  appropriate realm, it determines which Kerberos servers
  1474. serve that realm, and  contacts  one.   The  list  might  be
  1475. obtained through a configuration file or network service; as
  1476. long as the secret keys exchanged by realms are kept secret,
  1477. only denial of service results from a false Kerberos server.
  1478.  
  1479.      As in the AS exchange, the client may specify a  number
  1480. of  options in the KRB_TGS_REQ message.  The client prepares
  1481. the KRB_TGS_REQ message, providing an authentication  header
  1482. as  an  element  of the padata field, and including the same
  1483. fields as used in the KRB_AS_REQ message along with  several
  1484. optional   fields:   the  enc-authorization-data  field  for
  1485. __________________________
  1486. [14] This can be  accomplished  in  several  ways.   It
  1487. might  be  known beforehand (since the realm is part of
  1488. the principal identifier), or it might be stored  in  a
  1489. nameserver.   Presently,  however,  this information is
  1490. obtained from a configuration file.  If the realm to be
  1491. used  is  obtained from a nameserver, there is a danger
  1492. of being spoofed if the nameservice providing the realm
  1493. name  is  not  authenticated.  This might result in the
  1494. use of a realm which has been  compromised,  and  would
  1495. result  in  an attacker's ability to compromise the au-
  1496. thentication of the application server to the client.
  1497.  
  1498. Section 3.3.1.             - 23 -   Expires 28 February 1993
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.                   Version 5 - Revision 5.1
  1506.  
  1507.  
  1508. application server use and additional  tickets  required  by
  1509. some options.
  1510.  
  1511.      In preparing the authentication header, the client  can
  1512. select  a  sub-session key under which the response from the
  1513. Kerberos server will be encrypted[15].  If  the  sub-session
  1514. key  is  not  specified,  the  session  key from the ticket-
  1515. granting ticket will be used.  If the enc-authorization-data
  1516. is  present, it must be encrypted in the sub-session key, if
  1517. present, from the authenticator portion of  the  authentica-
  1518. tion  header,  or if not present in the session key from the
  1519. ticket-granting ticket.
  1520.  
  1521.      Once prepared, the message is sent to a Kerberos server
  1522. for the destination realm.  See section A.5 for pseudocode.
  1523.  
  1524. _3._3._2.  _R_e_c_e_i_p_t _o_f _K_R_B__T_G_S__R_E_Q _m_e_s_s_a_g_e
  1525.  
  1526.      The KRB_TGS_REQ message is processed in a manner  simi-
  1527. lar to the KRB_AS_REQ message, but there are many additional
  1528. checks to be performed.  First,  the  Kerberos  server  must
  1529. determine which server the accompanying ticket is for and it
  1530. must select the appropriate key to decrypt it.  For a normal
  1531. KRB_TGS_REQ message, it will be for the ticket granting ser-
  1532. vice, and the TGS's key will be used.  If the TGT was issued
  1533. by  another realm, then the appropriate inter-realm key must
  1534. be used.  If the accompanying ticket is not a ticket  grant-
  1535. ing  ticket for the current realm, but is for an application
  1536. server in the current realm, the RENEW, VALIDATE,  or  PROXY
  1537. options  are  specified  in  the request, and the server for
  1538. which a ticket is requested  is  the  server  named  in  the
  1539. accompanying ticket, then the KDC will decrypt the ticket in
  1540. the authentication header using the key of  the  server  for
  1541. which  it  was  issued.   If  no  ticket can be found in the
  1542. padata  field,  the  KDC_ERR_PADATA_TYPE_NOSUPP   error   is
  1543. returned.
  1544.  
  1545.      Once the accompanying ticket has  been  decrypted,  the
  1546. user-supplied checksum in the Authenticator must be verified
  1547. against  the  contents  of  the  request,  and  the  message
  1548. rejected  if  the checksums do not match (with an error code
  1549. of KRB_AP_ERR_MODIFIED) or if the checksum is not  keyed  or
  1550. not    collision-proof    (with    an    error    code    of
  1551. KRB_AP_ERR_INAPP_CKSUM).  If the checksum type is  not  sup-
  1552. ported,  the  KDC_ERR_SUMTYPE_NOSUPP  error is returned.  If
  1553. the authorization-data are present, they are decrypted using
  1554. the sub-session key from the Authenticator.
  1555. __________________________
  1556. [15] If the client selects a sub-session key, care must
  1557. be  taken to ensure the randomness of the selected sub-
  1558. session key.  One approach would be to generate a  ran-
  1559. dom  number  and  XOR  it with the session key from the
  1560. ticket-granting ticket.
  1561.  
  1562. Section 3.3.2.             - 24 -   Expires 28 February 1993
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.                   Version 5 - Revision 5.1
  1570.  
  1571.  
  1572.      If any of the  decryptions  indicate  failed  integrity
  1573. checks, the KRB_AP_ERR_BAD_INTEGRITY error is returned.
  1574.  
  1575. _3._3._3.  _G_e_n_e_r_a_t_i_o_n _o_f _K_R_B__T_G_S__R_E_P _m_e_s_s_a_g_e
  1576.  
  1577.      The KRB_TGS_REP message  shares  its  format  with  the
  1578. KRB_AS_REP  (KRB_KDC_REP),  but  with  its type field set to
  1579. KRB_TGS_REP.   The  detailed  specification  is  in  section
  1580. 5.4.2.
  1581.  
  1582.      The response will include a ticket  for  the  requested
  1583. server.   The  Kerberos  database is queried to retrieve the
  1584. record for the requested  server  (including  the  key  with
  1585. which  the ticket will be encrypted).  If the request is for
  1586. a ticket granting ticket for a remote realm, and if  no  key
  1587. is shared with the requested realm, then the Kerberos server
  1588. will select the realm "closest" to the requested realm  with
  1589. which it does share a key, and use that realm instead.  This
  1590. is the only case where the response from the KDC will be for
  1591. a different server than that requested by the client.
  1592.  
  1593.      By default, the address field, the  client's  name  and
  1594. realm,  the  list  of  transited realms, the time of initial
  1595. authentication, the expiration time, and  the  authorization
  1596. data  of  the  newly-issued  ticket  will be copied from the
  1597. ticket-granting ticket (TGT) or renewable  ticket.   If  the
  1598. transited  field needs to be updated, but the transited type
  1599. is  not  supported,  the  KDC_ERR_TRTYPE_NOSUPP   error   is
  1600. returned.
  1601.  
  1602.      If the request specifies an endtime, then  the  endtime
  1603. of the new ticket is set to the minimum of (a) that request,
  1604. (b) the endtime from the TGT, and (c) the starttime  of  the
  1605. TGT plus the minimum of the maximum life for the application
  1606. server and the maximum life for the local realm (the maximum
  1607. life  for  the requesting principal was already applied when
  1608. the TGT was issued).  If the new ticket is to be a  renewal,
  1609. then the endtime above is replaced by the minimum of (a) the
  1610. value of the renew_till field of  the  ticket  and  (b)  the
  1611. starttime  for  the  new  ticket  plus  the  life  (endtime-
  1612. starttime) of the old ticket.
  1613.  
  1614.      If the FORWARDED option has been  requested,  then  the
  1615. resulting ticket will contain the addresses specified by the
  1616. client.  This option will only be honored if the FORWARDABLE
  1617. flag  is  set in the TGT.  The PROXY option is similar;  the
  1618. resulting ticket will contain the addresses specified by the
  1619. client.   It  will  be honored only if the PROXIABLE flag in
  1620. the TGT is set.  The PROXY option will  not  be  honored  on
  1621. requests for additional ticket-granting tickets.
  1622.  
  1623.      If the requested start time is absent  or  indicates  a
  1624. time  in  the past, then the start time of the ticket is set
  1625. to  the  authentication  server's  current  time.    If   it
  1626.  
  1627.  
  1628. Section 3.3.3.             - 25 -   Expires 28 February 1993
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.                   Version 5 - Revision 5.1
  1636.  
  1637.  
  1638. indicates a time in the future, but the POSTDATED option has
  1639. not been specified or the MAY-POSTDATE flag is  not  set  in
  1640. the TGT, then the error KDC_ERR_CANNOT_POSTDATE is returned.
  1641. Otherwise,  if  the  ticket-granting  ticket  has  the  MAY-
  1642. POSTDATE  flag  set, then the resulting ticket will be post-
  1643. dated and the requested starttime  is  checked  against  the
  1644. policy of the local realm. If acceptable, the ticket's start
  1645. time is set as requested, and the INVALID flag is set.   The
  1646. postdated  ticket must be validated before use by presenting
  1647. it to the KDC after the starttime has  been  reached.   How-
  1648. ever,  in  no case may the starttime, endtime, or renew-till
  1649. time of a newly-issued postdated ticket  extend  beyond  the
  1650. renew-till time of the ticket-granting ticket.
  1651.  
  1652.      If the ENC-TKT-IN-SKEY option has been  specified,  and
  1653. if  an  additional  ticket has been included in the request,
  1654. then the KDC will  verify that the principal  identifier  of
  1655. the server in the ticket matches the requested server in the
  1656. KDC request (to make sure someone doesn't insert a different
  1657. ticket  in the request), decrypt the additional ticket using
  1658. the key for the server to which it was issued,  verify  that
  1659. it is a ticket-granting ticket, and use the session key from
  1660. the additional ticket to encrypt  the  new  ticket  it  will
  1661. issue instead of encrypting the new ticket in the key of the
  1662. server for which it is to be issued[16].
  1663.  
  1664.      If the name  of  the  server  in  the  ticket  that  is
  1665. presented to the KDC as part of the authentication header is
  1666. not that of  the  ticket-granting  server  itself,  and  the
  1667. server  is  registered in the realm of the KDC, If the RENEW
  1668. option is requested, then  the  KDC  will  verify  that  the
  1669. RENEWABLE  flag is set in the ticket and that the renew_till
  1670. time is still in the future.   If  the  VALIDATE  option  is
  1671. rqeuested,  the KDC will check that the starttime has passed
  1672. and the INVALID  flag  is  set.   If  the  PROXY  option  is
  1673. requested,  then  the KDC will check that the PROXIABLE flag
  1674. is set in the ticket.  If the tests succeed,  the  KDC  will
  1675. issue the appropriate new ticket.
  1676.  
  1677.      Whenever a  request  is  made  to  the  ticket-granting
  1678. server,  the  presented  ticket(s) is(are) checked against a
  1679. hot-list of tickets which have been canceled.  This hot-list
  1680. might  be  implemented by storing a range of issue dates for
  1681. "suspect tickets"; if a presented ticket had an authtime  in
  1682. that  range,  it  would  be rejected.  In this way, a stolen
  1683. ticket-granting ticket or renewable ticket cannot be used to
  1684. gain  additional  tickets  (renewals  or otherwise) once the
  1685. __________________________
  1686. [16] This allows easy  implementation  of  user-to-user
  1687. authentication  [6],  which uses ticket-granting ticket
  1688. session keys in lieu of secret server  keys  in  situa-
  1689. tions  where  such secret keys could be easily comprom-
  1690. ised.
  1691.  
  1692. Section 3.3.3.             - 26 -   Expires 28 February 1993
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.                   Version 5 - Revision 5.1
  1700.  
  1701.  
  1702. theft has been reported.  Any normal ticket obtained  before
  1703. it  was  reported  stolen  will still be valid (because they
  1704. require no interaction with the KDC), but only  until  their
  1705. normal expiration time.
  1706.  
  1707.      The ciphertext part of the response in the  KRB_TGS_REP
  1708. message is encrypted in the sub-session key from the Authen-
  1709. ticator, if  present,  or  the  session  key  key  from  the
  1710. ticket-granting  ticket.   It  is  not  encrypted  using the
  1711. client's  secret  key.   Furthermore,  the  client's   key's
  1712. expiration  date  and the key version number fields are left
  1713. out since these values are stored along  with  the  client's
  1714. database  record, and that record is not needed to satisfy a
  1715. request based on a ticket-granting ticket.  See section  A.6
  1716. for pseudocode.
  1717.  
  1718. _3._3._3._1.  _E_n_c_o_d_i_n_g _t_h_e _t_r_a_n_s_i_t_e_d _f_i_e_l_d
  1719.  
  1720.      If the identity of  the  server  in  the  TGT  that  is
  1721. presented to the KDC as part of the authentication header is
  1722. that of the ticket-granting service, but the TGT was  issued
  1723. from another realm, the KDC will look up the inter-realm key
  1724. shared with that realm and  use  that  key  to  decrypt  the
  1725. ticket.  If the ticket is valid, then the KDC will honor the
  1726. request, subject to the constraints outlined  above  in  the
  1727. section  describing  the AS exchange.  The realm part of the
  1728. client's identity will be  taken  from  the  ticket-granting
  1729. ticket.   The  name  of  the  realm  that issued the ticket-
  1730. granting ticket will be added to the transited field of  the
  1731. ticket  to  be  issued.  This is accomplished by reading the
  1732. transited field from the ticket-granting ticket, adding  the
  1733. new  realm,  then  constructing  and writing out its encoded
  1734. (shorthand) form (this may involve a  rearrangement  of  the
  1735. existing encoding).
  1736.  
  1737.      Note that the ticket-granting service does not add  the
  1738. name  of  its  own realm.  Instead, its responsibility is to
  1739. add the name of the previous realm.  This prevents  a  mali-
  1740. cious Kerberos server from intentionally leaving out its own
  1741. name (it could, however, omit other realms' names).
  1742.  
  1743.      The  names  of  neither  the  local   realm   nor   the
  1744. principal's realm are to be included in the transited field.
  1745. They appear elsewhere in the ticket and both  are  known  to
  1746. have  taken part in authenticating the principal.  Since the
  1747. endpoints  are  not  included,  both  local  and  single-hop
  1748. inter-realm  authentication result in a transited field that
  1749. is empty.
  1750.  
  1751.      Because the name of each realm transited  is  added  to
  1752. this  field, it might potentially be very long.  To decrease
  1753. the length of this field, its  contents  are  encoded.   The
  1754. initially  supported  encoding  is  optimized for the normal
  1755. case   of   inter-realm   communication:   a    hierarchical
  1756.  
  1757.  
  1758. Section 3.3.3.1.           - 27 -   Expires 28 February 1993
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.                   Version 5 - Revision 5.1
  1766.  
  1767.  
  1768. arrangement  of  realms  using  either domain or X.500 style
  1769. realm names.  This encoding (called DOMAIN-X500-COMPRESS) is
  1770. now described.
  1771.  
  1772.      Realm names in the transited field are separated  by  a
  1773. ",".   The ",", "\", trailing "."s, and leading spaces (" ")
  1774. are special characters, and if they  are  part  of  a  realm
  1775. name,  they must be quoted in the transited field by preced-
  1776. ing them with a "\".
  1777.  
  1778.      A realm name ending with a "." is interpreted as  being
  1779. prepended to the previous realm.  For example, we can encode
  1780. traversal of EDU, MIT.EDU,  ATHENA.MIT.EDU,  WASHINGTON.EDU,
  1781. and CS.WASHINGTON.EDU as:
  1782.  
  1783.      "EDU,MIT.,ATHENA.,WASHINGTON.EDU,CS.".
  1784.  
  1785. Note that if ATHENA.MIT.EDU, or CS.WASHINGTON.EDU were  end-
  1786. points,  that  they would not be included in this field, and
  1787. we would have:
  1788.  
  1789.      "EDU,MIT.,WASHINGTON.EDU"
  1790.  
  1791. A realm name beginning with a "/" is  interpreted  as  being
  1792. appended to the previous realm[17].  If it is  to  stand  by
  1793. itself,  then  it  should be preceded by a space (" ").  For
  1794. example, we can encode traversal of /COM/HP/APOLLO, /COM/HP,
  1795. /COM, and /COM/DEC as:
  1796.  
  1797.      "/COM,/HP,/APOLLO, /COM/DEC".
  1798.  
  1799. Like the example above, if /COM/HP/APOLLO and  /COM/DEC  are
  1800. endpoints,  they  they  would not be included in this field,
  1801. and we would have:
  1802.  
  1803.      "/COM,/HP"
  1804.  
  1805.  
  1806.      A null subfield preceding or following a ","  indicates
  1807. that  all  realms  between  the  previous realm and the next
  1808. realm have been traversed[18].  Thus,  ","  means  that  all
  1809. realms along the path between the client and the server have
  1810. been traversed. ",EDU, /COM," means  that  that  all  realms
  1811. from  the  client's  realm  up  to  EDU  (in  a domain style
  1812. __________________________
  1813. [17] For the purpose of appending, the realm  preceding
  1814. the  first  listed  realm  is considered to be the null
  1815. realm ("").
  1816. [18] For the purpose of  interpreting  null  subfields,
  1817. the  client's  realm  is considered to precede those in
  1818. the transited field, and the  server's  realm  is  con-
  1819. sidered to follow them.
  1820.  
  1821.  
  1822.  
  1823. Section 3.3.3.1.           - 28 -   Expires 28 February 1993
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.                   Version 5 - Revision 5.1
  1831.  
  1832.  
  1833. hierarchy) have been traversed,  and  that  everything  from
  1834. /COM  down  to the server's realm in an X.500 style has also
  1835. been traversed.  This could occur if the EDU  realm  in  one
  1836. hierarchy  shares  an inter-realm key directly with the /COM
  1837. realm in another hierarchy.
  1838.  
  1839. _3._3._4.  _R_e_c_e_i_p_t _o_f _K_R_B__T_G_S__R_E_P _m_e_s_s_a_g_e
  1840.  
  1841. When the KRB_TGS_REP is received by the client, it  is  pro-
  1842. cessed  in  the  same  manner  as  the KRB_AS_REP processing
  1843. described above.  The primary difference is that the cipher-
  1844. text  part  of the response must be decrypted using the ses-
  1845. sion key from the ticket-granting  ticket  rather  than  the
  1846. client's secret key.  See section A.7 for pseudocode.
  1847.  
  1848. _3._4.  _T_h_e _K_R_B__S_A_F_E _E_x_c_h_a_n_g_e
  1849.  
  1850.      The KRB_SAFE message may be used by  clients  requiring
  1851. the   ability  to  detect  modifications  of  messages  they
  1852. exchange.  It achieves this by including a keyed  collision-
  1853. proof  checksum  of  the user data and some control informa-
  1854. tion.  The checksum is keyed with an encryption key (usually
  1855. the  last  key negotiated via subkeys, or the session key if
  1856. no negotiation has occured).
  1857.  
  1858. _3._4._1.  _G_e_n_e_r_a_t_i_o_n _o_f _a _K_R_B__S_A_F_E _m_e_s_s_a_g_e
  1859.  
  1860. When an application wishes to send a  KRB_SAFE  message,  it
  1861. collects  its  data  and the appropriate control information
  1862. and computes a checksum over them.  The  checksum  algorithm
  1863. should  be some sort of keyed one-way hash function (such as
  1864. the RSA-MD5-DES  checksum  algorithm  specified  in  section
  1865. 6.4.5,  or the DES MAC), generated using the sub-session key
  1866. if present, or the session key.  Different algorithms may be
  1867. selected  by  changing  the  checksum  type  in the message.
  1868. Unkeyed or non-collision-proof checksums  are  not  suitable
  1869. for this use.
  1870.  
  1871.      The  control  information  for  the  KRB_SAFE   message
  1872. includes  both  a  timestamp  and  a  sequence  number.  The
  1873. designer of an application using the KRB_SAFE  message  must
  1874. choose  at  least  one  of  the two mechanisms.  This choice
  1875. should be based on the needs of the application protocol.
  1876.  
  1877.      Sequence numbers are useful when all messages sent will
  1878. be  received  by  one's peer.  Connection state is presently
  1879. required to maintain the session  key,  so  maintaining  the
  1880. next  sequence number should not present an additional prob-
  1881. lem.
  1882.  
  1883.      If the application protocol  is  expected  to  tolerate
  1884. lost  messages  without  them  being  resent, the use of the
  1885. timestamp is the  appropriate  replay  detection  mechanism.
  1886. Using  timestamps  is  also  the  appropriate  mechanism for
  1887.  
  1888.  
  1889. Section 3.4.1.             - 29 -   Expires 28 February 1993
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.                   Version 5 - Revision 5.1
  1897.  
  1898.  
  1899. multi-cast protocols where all of one's peers share a common
  1900. sub-session  key, but some messages will be sent to a subset
  1901. of one's peers.
  1902.  
  1903.      After computing the checksum, the client then transmits
  1904. the information and checksum to the recipient in the message
  1905. format specified in section 5.6.1.
  1906.  
  1907. _3._4._2.  _R_e_c_e_i_p_t _o_f _K_R_B__S_A_F_E _m_e_s_s_a_g_e
  1908.  
  1909. When an application receives a KRB_SAFE message, it verifies
  1910. it  as  follows.   If  any  error  occurs,  an error code is
  1911. reported for use by the application.
  1912.  
  1913.      The message is first checked by verifying that the pro-
  1914. tocol  version and type fields match the current version and
  1915. KRB_SAFE,   respectively.    A    mismatch    generates    a
  1916. KRB_AP_ERR_BADVERSION  or  KRB_AP_ERR_MSG_TYPE  error.   The
  1917. application verifies that the checksum used is a  collision-
  1918. proof    keyed    checksum,    and   if   it   is   not,   a
  1919. KRB_AP_ERR_INAPP_CKSUM error is  generated.   The  recipient
  1920. verifies  that the operating system's report of the sender's
  1921. address matches the sender's address in the message, and (if
  1922. a  recipient  address is specified or the recipient requires
  1923. an address) that one of the recipient's addresses appears as
  1924. the  recipient's address in the message.  A failed match for
  1925. either case generates a KRB_AP_ERR_BADADDR error.  Then  the
  1926. timestamp  and  usec  and/or  the sequence number fields are
  1927. checked.   If  timestamp  and  usec  are  expected  and  not
  1928. present,   or   they   are  present  but  not  current,  the
  1929. KRB_AP_ERR_SKEW error is generated.   If  the  server  name,
  1930. along with the client name, time and microsecond fields from
  1931. the Authenticator match any recently-seen such  tuples,  the
  1932. KRB_AP_ERR_REPEAT  error  is  generated.   If  an  incorrect
  1933. sequence  number  is  included,  or  a  sequence  number  is
  1934. expected  but  not present, the KRB_AP_ERR_BADORDER error is
  1935. generated.  If neither a timestamp and usec  or  a  sequence
  1936. number is present, a KRB_AP_ERR_MODIFIED error is generated.
  1937. Finally, the checksum is computed over the data and  control
  1938. information,  and if it doesn't match the received checksum,
  1939. a KRB_AP_ERR_MODIFIED error is generated.
  1940.  
  1941.      If all the checks succeed, the application  is  assured
  1942. that the message was generated by its peer and was not modi-
  1943. fied in transit.
  1944.  
  1945. _3._5.  _T_h_e _K_R_B__P_R_I_V _E_x_c_h_a_n_g_e
  1946.  
  1947.      The KRB_PRIV message may be used by  clients  requiring
  1948. confidentiality  and  the ability to detect modifications of
  1949. exchanged messages.  It achieves this by encrypting the mes-
  1950. sages and adding control information.
  1951.  
  1952.  
  1953.  
  1954.  
  1955. Section 3.5.               - 30 -   Expires 28 February 1993
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.                   Version 5 - Revision 5.1
  1963.  
  1964.  
  1965. _3._5._1.  _G_e_n_e_r_a_t_i_o_n _o_f _a _K_R_B__P_R_I_V _m_e_s_s_a_g_e
  1966.  
  1967. When an application wishes to send a  KRB_PRIV  message,  it
  1968. collects  its  data  and the appropriate control information
  1969. (specified in section 5.7.1)  and  encrypts  them  under  an
  1970. encryption key (usually the last key negotiated via subkeys,
  1971. or the session key if no negotiation has occured).  As  part
  1972. of  the  control  information, the client must choose to use
  1973. either a timestamp or a sequence number (or both);  see  the
  1974. discussion  in section 3.4.1 for guidelines on which to use.
  1975. After the user data and control information  are  encrypted,
  1976. the  client  transmits  the  ciphertext  and some "envelope"
  1977. information to the recipient.
  1978.  
  1979. _3._5._2.  _R_e_c_e_i_p_t _o_f _K_R_B__P_R_I_V _m_e_s_s_a_g_e
  1980.  
  1981. When an application receives a KRB_PRIV message, it verifies
  1982. it  as  follows.   If  any  error  occurs,  an error code is
  1983. reported for use by the application.
  1984.  
  1985.      The message is first checked by verifying that the pro-
  1986. tocol  version and type fields match the current version and
  1987. KRB_PRIV,   respectively.    A    mismatch    generates    a
  1988. KRB_AP_ERR_BADVERSION  or  KRB_AP_ERR_MSG_TYPE  error.   The
  1989. application then decrypts the ciphertext and  processes  the
  1990. resultant  plaintext.   If decryption shows the data to have
  1991. been modified,  a  KRB_AP_ERR_BAD_INTEGRITY  error  is  gen-
  1992. erated.   The recipient verifies that the operating system's
  1993. report of the sender's address matches the sender's  address
  1994. in  the message, and (if a recipient address is specified or
  1995. the  recipient  requires  an  address)  that  one   of   the
  1996. recipient's  addresses appears as the recipient's address in
  1997. the message.  A failed match for  either  case  generates  a
  1998. KRB_AP_ERR_BADADDR  error.   Then  the  timestamp  and  usec
  1999. and/or the sequence number fields are checked.  If timestamp
  2000. and  usec  are expected and not present, or they are present
  2001. but not current, the KRB_AP_ERR_SKEW error is generated.  If
  2002. the  server  name,  along  with  the  client  name, time and
  2003. microsecond  fields  from  the   Authenticator   match   any
  2004. recently-seen  such  tuples,  the KRB_AP_ERR_REPEAT error is
  2005. generated.  If an incorrect sequence number is included,  or
  2006. a   sequence   number  is  expected  but  not  present,  the
  2007. KRB_AP_ERR_BADORDER error is generated.  If neither a  time-
  2008. stamp   and   usec  or  a  sequence  number  is  present,  a
  2009. KRB_AP_ERR_MODIFIED error is generated.  Finally, the check-
  2010. sum  is  computed over the data and control information, and
  2011. if   it   doesn't   match   the   received    checksum,    a
  2012. KRB_AP_ERR_MODIFIED error is generated.
  2013.  
  2014.      If all the checks succeed, the application  can  assume
  2015. the  message  was  generated  by  its peer, and was securely
  2016. transmitted (without intruders able to see  the  unencrypted
  2017. contents).
  2018.  
  2019.  
  2020.  
  2021. Section 3.5.2.             - 31 -   Expires 28 February 1993
  2022.  
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028.                   Version 5 - Revision 5.1
  2029.  
  2030.  
  2031. _4.  _T_h_e _K_e_r_b_e_r_o_s _D_a_t_a_b_a_s_e
  2032.  
  2033. The Kerberos server must have access to a database  contain-
  2034. ing  the principal identifiers and secret keys of principals
  2035. to be authenticated[19].
  2036.  
  2037. _4._1.  _D_a_t_a_b_a_s_e _c_o_n_t_e_n_t_s
  2038.  
  2039. A database entry  should  contain  at  least  the  following
  2040. fields:
  2041.  
  2042. _F_i_e_l_d                _V_a_l_u_e
  2043.  
  2044. name                 Principal's                    identif-
  2045. ier
  2046. key                  Principal's secret key
  2047. p_kvno               Principal's key version
  2048. max_life             Maximum lifetime for Tickets
  2049. max_renewable_life   Maximum total lifetime for renewable Tickets
  2050.  
  2051. The name field is an encoding of the principal's identifier.
  2052. The  key  field contains an encryption key.  This key is the
  2053. principal's secret key.  (The key can  be  encrypted  before
  2054. storage  under a Kerberos "master key" to protect it in case
  2055. the database is compromised but the master key is  not.   In
  2056. that case, an extra field must be added to indicate the mas-
  2057. ter key version used, see below.) The p_kvno  field  is  the
  2058. key  version  number  of  the  principal's  secret key.  The
  2059. max_life field contains the maximum allowable lifetime (end-
  2060. time  - starttime) for any Ticket issued for this principal.
  2061. The max_renewable_life field contains the maximum  allowable
  2062. total  lifetime  for  any  renewable  Ticket issued for this
  2063. principal.  (See section 3.1 for a description of how  these
  2064. lifetimes  are  used  in determining the lifetime of a given
  2065. Ticket.)
  2066.  
  2067.      A server may provide KDC service to several realms,  as
  2068. long  as the database representation provides a mechanism to
  2069. distinguish between principal records with identifiers which
  2070. differ only in the realm name.
  2071.  
  2072.      When an application server's key changes, if the change
  2073. is  routine  (i.e.  not  the result of disclosure of the old
  2074. key), the old key should be retained by the server until all
  2075. __________________________
  2076. [19] The implementation of the Kerberos server need not
  2077. combine  the  database  and  the  server  on  the  same
  2078. machine; it is feasible to store the principal database
  2079. in, say, a network name service, as long as the entries
  2080. stored therein are protected  from  disclosure  to  and
  2081. modification  by  unauthorized  parties.   However,  we
  2082. recommend against such strategies,  as  they  can  make
  2083. system management and threat analysis quite complex.
  2084.  
  2085. Section 4.1.               - 32 -   Expires 28 February 1993
  2086.  
  2087.  
  2088.  
  2089.  
  2090.  
  2091.  
  2092.                   Version 5 - Revision 5.1
  2093.  
  2094.  
  2095. tickets that had been issued using that  key  have  expired.
  2096. Because  of  this,  it  is  possible  for several keys to be
  2097. active for a single principal.  Ciphertext  encrypted  in  a
  2098. principal's key is always tagged with the version of the key
  2099. that was used for encryption, to help the recipient find the
  2100. proper key for decryption.
  2101.  
  2102.      When more than one key is active for a particular prin-
  2103. cipal,  the  principal will have more than one record in the
  2104. Kerberos database.  The keys and key  version  numbers  will
  2105. differ  between  the  records (the rest of the fields may or
  2106. may not be the same). Whenever Kerberos issues a ticket,  or
  2107. responds  to  a request for initial authentication, the most
  2108. recent key (known by the Kerberos server) will be  used  for
  2109. encryption.   This  is  the key with the highest key version
  2110. number.
  2111.  
  2112. _4._2.  _A_d_d_i_t_i_o_n_a_l _f_i_e_l_d_s
  2113.  
  2114. Project Athena's KDC implementation uses  additional  fields
  2115. in its database:
  2116.  
  2117. _F_i_e_l_d        _V_a_l_u_e
  2118.  
  2119. K_kvno       Kerberos' key version
  2120. expiration   Expiration date for entry
  2121. attributes   Bit field of attributes
  2122. mod_date     Timestamp of last modification
  2123. mod_name     Modifying principal's identifier
  2124.  
  2125.  
  2126. The K_kvno field indicates the key version of  the  Kerberos
  2127. master  key  under  which  the  principal's  secret  key  is
  2128. encrypted.
  2129.  
  2130.      After an entry's expiration date has  passed,  the  KDC
  2131. will  return an error to any client attempting to gain tick-
  2132. ets as or for the principal.  (A database may want to  main-
  2133. tain  two  expiration  dates: one for the principal, and one
  2134. for the principal's current key.  This allows password aging
  2135. to  work  independently  of the principal's expiration date.
  2136. However, due to the limited space in the responses, the  KDC
  2137. must  combine  the  key  expiration and principal expiration
  2138. date into a single value called "key_exp", which is used  as
  2139. a hint to the user to take administrative action.)
  2140.  
  2141.      The attributes field is a bitfield used to  govern  the
  2142. operations  involving  the  principal.   This field might be
  2143. useful in conjunction with user registration procedures, for
  2144. site-specific   policy   implementations   (Project   Athena
  2145. currently uses it for their user registration  process  con-
  2146. trolled  by  the  system-wide database service, Moira [7]),.
  2147. or to identify the "string to key" conversion algorithm used
  2148. for a principal's key[20].  Other bits are used to  indicate
  2149. __________________________
  2150. [20] See the discussion of the padata field in  section
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.                   Version 5 - Revision 5.1
  2157.  
  2158.  
  2159. that certain ticket options should not be allowed in tickets
  2160. encrypted  under a principal's key (one bit each):  Disallow
  2161. issuing  postdated  tickets,  disallow  issuing  forwardable
  2162. tickets,  disallow  issuing tickets based on TGT authentica-
  2163. tion, disallow issuing renewable tickets,  disallow  issuing
  2164. proxiable  tickets,  and  disallow issuing tickets for which
  2165. the principal is the server.
  2166.  
  2167.      The mod_date field contains the time of last  modifica-
  2168. tion  of the entry, and the mod_name field contains the name
  2169. of the principal which last modified the entry.
  2170.  
  2171. _4._3.  _F_r_e_q_u_e_n_t_l_y _C_h_a_n_g_i_n_g _F_i_e_l_d_s
  2172.  
  2173.      Some KDC implementations may wish to maintain the  last
  2174. time  that  a  request  was  made by a particular principal.
  2175. Information that might be maintained includes  the  time  of
  2176. the  last  request,  the  time  of  the  last  request for a
  2177. ticket-granting ticket, the  time  of  the  last  use  of  a
  2178. ticket-granting  ticket,  or  other times.  This information
  2179. can then be returned to the user in the last-req field  (see
  2180. section 5.2).
  2181.  
  2182.      Other frequently changing information that can be main-
  2183. tained  is  the  latest expiration time for any tickets that
  2184. have been issued using each key.  This field would  be  used
  2185. to indicate how long old keys must remain valid to allow the
  2186. continued use of outstanding tickets.
  2187.  
  2188. _4._4.  _S_i_t_e _C_o_n_s_t_a_n_t_s
  2189.  
  2190.      The KDC implementation should have the following confi-
  2191. gurable  constants  or options, to allow an administrator to
  2192. make and enforce policy decisions:
  2193.  
  2194. o+  The minimum supported lifetime (used to determine whether
  2195.    the  KDC_ERR_NEVER_VALID error should be returned).  This
  2196.    constant  should  reflect  reasonable   expectations   of
  2197.    round-trip  time  to the KDC, encryption/decryption time,
  2198.    and processing time by the client and target server,  and
  2199.    it should allow for a minimum "useful" lifetime.
  2200.  
  2201. o+  The maximum allowable total  (renewable)  lifetime  of  a
  2202.    ticket (renew_till - starttime).
  2203.  
  2204. o+  The maximum allowable lifetime of  a  ticket  (endtime  -
  2205.    starttime).
  2206.  
  2207. o+  Whether to allow the issue of tickets with empty  address
  2208.    fields  (including the ability to specify that such tick-
  2209.    ets may only be issued  if  the  request  specifies  some
  2210. __________________________
  2211. 5.4.2 for details on why this can be useful.
  2212.  
  2213.  
  2214.  
  2215. Section 4.4.               - 34 -   Expires 28 February 1993
  2216.  
  2217.  
  2218.  
  2219.  
  2220.  
  2221.  
  2222.                   Version 5 - Revision 5.1
  2223.  
  2224.  
  2225.    authorization_data).
  2226.  
  2227. o+  Whether proxiable, forwardable, renewable or post-datable
  2228.    tickets are to be issued.
  2229.  
  2230.  
  2231. _5.  _M_e_s_s_a_g_e _S_p_e_c_i_f_i_c_a_t_i_o_n_s
  2232.  
  2233.      The following sections describe the exact contents  and
  2234. encoding  of  protocol messages and objects.  The ASN.1 base
  2235. definitions are presented  in  the  first  subsection.   The
  2236. remaining  subsections specify the protocol objects (tickets
  2237. and authenticators) and messages.  Specification of  encryp-
  2238. tion  and  checksum  techniques,  and  the fields related to
  2239. them, appear in section 6.
  2240.  
  2241. _5._1.  _A_S_N._1 _D_i_s_t_i_n_g_u_i_s_h_e_d _E_n_c_o_d_i_n_g _R_e_p_r_e_s_e_n_t_a_t_i_o_n
  2242.  
  2243.      All uses of  ASN.1  in  Kerberos  shall  use  the  Dis-
  2244. tinguished  Encoding  Representation of the data elements as
  2245. described in the X.509 specification, section 8.7  [8].
  2246.  
  2247. _5._2.  _A_S_N._1 _B_a_s_e _D_e_f_i_n_i_t_i_o_n_s
  2248.  
  2249.      The following ASN.1 base definitions are  used  in  the
  2250. rest  of this section.  Note that since the underscore char-
  2251. acter (_) is not permitted in ASN.1 names, the hyphen (-) is
  2252. used in its place for the purposes of ASN.1 names.
  2253.  
  2254. Realm ::=           GeneralString
  2255. PrincipalName ::=   SEQUENCE {
  2256.                     name-type[0]     INTEGER,
  2257.                     name-string[1]   SEQUENCE OF GeneralString
  2258. }
  2259.  
  2260.  
  2261. Kerberos realms are encoded as GeneralStrings.  Realms shall
  2262. not  contain  a  character  with the code 0 (the ASCII NUL).
  2263. Most realms  will  usually  consist  of  several  components
  2264. separated  by  periods  (.), in the style of Internet Domain
  2265. Names, or separated by slashes (/) in  the  style  of  X.500
  2266. names.   Acceptable  forms  for realm names are specified in
  2267. section 7.  A PrincipalName is  a  typed  sequence  of  com-
  2268. ponents consisting of the following sub-fields:
  2269.  
  2270. name-type This field specifies the type of  name  that  fol-
  2271.           lows.   Pre-defined  values  for  this  field  are
  2272.           specified in section 7.2.  The name-type should be
  2273.           treated as a hint.  Ignoring the name type, no two
  2274.           names can be the same (i.e. at least  one  of  the
  2275.           components,  or  the  realm,  must  be different).
  2276.           This constraint may be eliminated in the future.
  2277.  
  2278. name-stringThis field encodes a sequence of components  that
  2279.  
  2280.  
  2281. Section 5.2.               - 35 -   Expires 28 February 1993
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.                   Version 5 - Revision 5.1
  2289.  
  2290.  
  2291.           form  a name, each component encoded as a General-
  2292.           String.  Taken together,  a  PrincipalName  and  a
  2293.           Realm  form  a principal identifier.  Most Princi-
  2294.           palNames will have only a  few  components  (typi-
  2295.           cally one or two).
  2296.  
  2297.  
  2298.  
  2299.         KerberosTime ::=   GeneralizedTime
  2300.                            -- Specifying UTC time zone (Z)
  2301.  
  2302.  
  2303.      The timestamps used in Kerberos are encoded as General-
  2304. izedTimes.   An encoding shall specify the UTC time zone (Z)
  2305. and  shall  not  include  any  fractional  portions  of  the
  2306. seconds.   It  further  shall  not  include  any separators.
  2307. Example: The only valid format for UTC time  6  minutes,  27
  2308. seconds after 9 pm on 6 November 1985 is 19851106210627Z.
  2309.  
  2310.  HostAddress ::=     SEQUENCE  {
  2311.                      addr-type[0]             INTEGER,
  2312.                      address[1]               OCTET STRING
  2313.  }
  2314.  
  2315.  HostAddresses ::=   SEQUENCE OF SEQUENCE {
  2316.                      addr-type[0]             INTEGER,
  2317.                      address[1]               OCTET STRING
  2318.  }
  2319.  
  2320.  
  2321.      The host adddress encodings consists of two fields:
  2322.  
  2323. addr-type This field  specifies the  type  of  address  that
  2324.           follows.   Pre-defined  values  for this field are
  2325.           specified in section 8.1.
  2326.  
  2327. address   This field encodes a single address of type  addr-
  2328.           type.
  2329.  
  2330. The two forms differ slightly. HostAddress contains  exactly
  2331. one  address;  HostAddresses contains a sequence of possibly
  2332. many addresses.
  2333.  
  2334. AuthorizationData ::=   SEQUENCE OF SEQUENCE {
  2335.                         ad-type[0]               INTEGER,
  2336.                         ad-data[1]               OCTET STRING
  2337. }
  2338.  
  2339.  
  2340. ad-data   This  field  contains  authorization  data  to  be
  2341.           interpreted   according   to   the  value  of  the
  2342.           corresponding ad-type field.
  2343.  
  2344. ad-type   This field specifies the format  for  the  ad-data
  2345.  
  2346. Section 5.2.               - 36 -   Expires 28 February 1993
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353.                   Version 5 - Revision 5.1
  2354.  
  2355.  
  2356.           subfield.   All  negative  values are reserved for
  2357.           local use.  Non-negative values are  reserved  for
  2358.           registered use.
  2359.  
  2360.                 APOptions ::=   BIT STRING {
  2361.                                 reserved(0),
  2362.                                 use-session-key(1),
  2363.                                 mutual-required(2)
  2364.                 }
  2365.  
  2366.                 TicketFlags ::=   BIT STRING {
  2367.                                   reserved(0),
  2368.                                   forwardable(1),
  2369.                                   forwarded(2),
  2370.                                   proxiable(3),
  2371.                                   proxy(4),
  2372.                                   may-postdate(5),
  2373.                                   postdated(6),
  2374.                                   invalid(7),
  2375.                                   renewable(8),
  2376.                                   initial(9),
  2377.                                   pre-authent(10),
  2378.                                   hw-authent(11)
  2379.                 }
  2380.  
  2381.                KDCOptions ::=   BIT STRING {
  2382.                                 reserved(0),
  2383.                                 forwardable(1),
  2384.                                 forwarded(2),
  2385.                                 proxiable(3),
  2386.                                 proxy(4),
  2387.                                 allow-postdate(5),
  2388.                                 postdated(6),
  2389.                                 unused7(7),
  2390.                                 renewable(8),
  2391.                                 unused9(9),
  2392.                                 unused10(10),
  2393.                                 unused11(11),
  2394.                                 renewable-ok(27),
  2395.                                 enc-tkt-in-skey(28),
  2396.                                 renew(30),
  2397.                                 validate(31)
  2398.                }
  2399.  
  2400.  
  2401.          LastReq ::=   SEQUENCE OF SEQUENCE {
  2402.                        lr-type[0]               INTEGER,
  2403.                        lr-value[1]              KerberosTime
  2404.          }
  2405.  
  2406.  
  2407. lr-type   This field indicates how  the  following  lr-value
  2408.           field  is  to  be  interpreted.   Negative  values
  2409.  
  2410.  
  2411. Section 5.2.               - 37 -   Expires 28 February 1993
  2412.  
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.                   Version 5 - Revision 5.1
  2419.  
  2420.  
  2421.           indicate that the information pertains only to the
  2422.           responding server.  Non-negative values pertain to
  2423.           all servers for the realm.
  2424.  
  2425.           If the lr-type field is zero (0), then no informa-
  2426.           tion is conveyed by the lr-value subfield.  If the
  2427.           absolute value of the lr-type field  is  one  (1),
  2428.           then  the  lr-value  subfield  is the time of last
  2429.           initial request for a TGT.  If it is two (2), then
  2430.           the  lr-value subfield is the time of last initial
  2431.           request.  If it is three (3),  then  the  lr-value
  2432.           subfield  is  the  time  of  issue  for the newest
  2433.           ticket-granting ticket used.  If it is  four  (4),
  2434.           then the lr-value subfield is the time of the last
  2435.           renewal.  If it is five  (5),  then  the  lr-value
  2436.           subfield  is  the  time  of  last  request (of any
  2437.           type).
  2438.  
  2439.  
  2440. lr-value  This field contains the time of the last  request.
  2441.           The time must be interpreted according to the con-
  2442.           tents of the accompanying lr-type subfield.
  2443.  
  2444.      See section 6 for the definitions of  Checksum,  Check-
  2445. sumType,  EncryptedData,  EncryptionKey, EncryptionType, and
  2446. KeyType.
  2447.  
  2448. _5._3.  _T_i_c_k_e_t_s _a_n_d _A_u_t_h_e_n_t_i_c_a_t_o_r_s
  2449.  
  2450.      This section describes the format and encryption param-
  2451. eters  for  tickets  and  authenticators.   When a ticket or
  2452. authenticator is  included  in  a  protocol  message  it  is
  2453. treated as an opaque object.
  2454.  
  2455. _5._3._1.  _T_i_c_k_e_t_s
  2456.  
  2457.      A ticket is a record that helps a  client  authenticate
  2458. to a service.  A Ticket contains the following information:
  2459.  
  2460. Ticket ::=                    [APPLICATION 1] SEQUENCE {
  2461.                               tkt-vno[0]                   INTEGER,
  2462.                               realm[1]                     Realm,
  2463.                               sname[2]                     PrincipalName,
  2464.                               enc-part[3]                  EncryptedData
  2465. }
  2466. -- Encrypted part of ticket
  2467. EncTicketPart ::=             [APPLICATION 3] SEQUENCE {
  2468.                               flags[0]                     TicketFlags,
  2469.                               key[1]                       EncryptionKey,
  2470.                               crealm[2]                    Realm,
  2471.                               cname[3]                     PrincipalName,
  2472.                               transited[4]                 TransitedEncoding,
  2473.                               authtime[5]                  KerberosTime,
  2474.                               starttime[6]                 KerberosTime OPTIONAL,
  2475.  
  2476.  
  2477. Section 5.3.1.             - 38 -   Expires 28 February 1993
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.                   Version 5 - Revision 5.1
  2485.  
  2486.  
  2487.                               endtime[7]                   KerberosTime,
  2488.                               renew-till[8]                KerberosTime OPTIONAL,
  2489.                               caddr[9]                     HostAddresses OPTIONAL,
  2490.                               authorization-data[10]       AuthorizationData OPTIONAL
  2491. }
  2492. -- encoded Transited field
  2493. TransitedEncoding ::=         SEQUENCE {
  2494.                               tr-type[0]                   INTEGER, -- must be registered
  2495.                               contents[1]                  OCTET STRING
  2496. }
  2497.  
  2498. The encoding of EncTicketPart is encrypted in the key shared
  2499. by  Kerberos  and  the end server (the server's secret key).
  2500. See section 6 for the format of the ciphertext.
  2501.  
  2502. tkt-vno   This field specifies the version  number  for  the
  2503.           ticket  format.   This  document describes version
  2504.           number 5.
  2505.  
  2506.  
  2507. realm     This field  specifies  the  realm  that  issued  a
  2508.           ticket.  It also serves to identify the realm part
  2509.           of the server's  principal  identifier.   Since  a
  2510.           Kerberos server can only issue tickets for servers
  2511.           within its realm, the two will always  be  identi-
  2512.           cal.
  2513.  
  2514.  
  2515. sname     This field specifies the name part of the server's
  2516.           identity.
  2517.  
  2518.  
  2519. enc-part  This field holds the  encrypted  encoding  of  the
  2520.           EncTicketPart sequence.
  2521.  
  2522.  
  2523. flags     This field indicates which of various options were
  2524.           used  or requested when the ticket was issued.  It
  2525.           is a bit-field, where  the  selected  options  are
  2526.           indicated  by  the  bit  being  set  (1),  and the
  2527.           unselected options and reserved fields being reset
  2528.           (0).   Bit  0  is  the  most significant bit.  The
  2529.           encoding of the bits is specified in section  5.2.
  2530.           The  flags  are  described in more detail above in
  2531.           section 2.  The meanings of the flags are:
  2532.  
  2533.  
  2534.           _B_i_t(_s) _N_a_m_e         _D_e_s_c_r_i_p_t_i_o_n
  2535.  
  2536.           0      RESERVED
  2537.                               Reserved for future  expansion  of  this
  2538.                               field.
  2539.  
  2540.  
  2541.  
  2542.  
  2543.  
  2544. Section 5.3.1.             - 39 -   Expires 28 February 1993
  2545.  
  2546.  
  2547.  
  2548.  
  2549.  
  2550.  
  2551.                   Version 5 - Revision 5.1
  2552.  
  2553.  
  2554.           1      FORWARDABLE
  2555.                               The FORWARDABLE flag  is  normally  only
  2556.                               interpreted  by  the  TGS,  and  can  be
  2557.                               ignored by end servers.  When set,  this
  2558.                               flag  tells  the  ticket-granting server
  2559.                               that it is OK to  issue  a  new  ticket-
  2560.                               granting ticket with a different network
  2561.                               address based on the presented ticket.
  2562.  
  2563.           2      FORWARDED
  2564.                               When set, this flag indicates  that  the
  2565.                               ticket  has either been forwarded or was
  2566.                               issued based on authentication involving
  2567.                               a forwarded ticket-granting ticket.
  2568.  
  2569.           3      PROXIABLE
  2570.                               The  PROXIABLE  flag  is  normally  only
  2571.                               interpreted  by  the  TGS,  and  can  be
  2572.                               ignored by end servers.   The  PROXIABLE
  2573.                               flag  has an interpretation identical to
  2574.                               that of  the  FORWARDABLE  flag,  except
  2575.                               that   the   PROXIABLE  flag  tells  the
  2576.                               ticket-granting server  that  only  non-
  2577.                               ticket-granting  tickets  may  be issued
  2578.                               with different network addresses.
  2579.  
  2580.           4      PROXY
  2581.                               When set, this  flag  indicates  that  a
  2582.                               ticket is a proxy.
  2583.  
  2584.           5      MAY-POSTDATE
  2585.                               The MAY-POSTDATE flag is  normally  only
  2586.                               interpreted  by  the  TGS,  and  can  be
  2587.                               ignored by end servers.  This flag tells
  2588.                               the  ticket-granting server that a post-
  2589.                               dated ticket may be issued based on this
  2590.                               ticket-granting ticket.
  2591.  
  2592.           6      POSTDATED
  2593.                               This flag indicates that this ticket has
  2594.                               been  postdated.   The  end-service  can
  2595.                               check the authtime field to see when the
  2596.                               original authentication occurred.
  2597.  
  2598.           7      INVALID
  2599.                               This flag indicates  that  a  ticket  is
  2600.                               invalid, and it must be validated by the
  2601.                               KDC  before  use.   Application  servers
  2602.                               must reject tickets which have this flag
  2603.                               set.
  2604.  
  2605.           8      RENEWABLE
  2606.                               The  RENEWABLE  flag  is  normally  only
  2607.                               interpreted  by the TGS, and can usually
  2608.                               be ignored by end servers (some particu-
  2609.                               larly careful servers may wish to disal-
  2610.                               low  renewable  tickets).   A  renewable
  2611.                               ticket  can be used to obtain a replace-
  2612.                               ment ticket  that  expires  at  a  later
  2613.                               date.
  2614.  
  2615.  
  2616.  
  2617.  
  2618. Section 5.3.1.             - 40 -   Expires 28 February 1993
  2619.  
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.                   Version 5 - Revision 5.1
  2626.  
  2627.  
  2628.           9      INITIAL
  2629.                               This flag indicates that this ticket was
  2630.                               issued  using  the  AS protocol, and not
  2631.                               issued  based   on   a   ticket-granting
  2632.                               ticket.
  2633.  
  2634.           10     PRE-AUTHENT
  2635.                               This flag indicates that during  initial
  2636.                               authentication, the client was authenti-
  2637.                               cated by the KDC  before  a  ticket  was
  2638.                               issued.    The   strength  of  the  pre-
  2639.                               authentication method is not  indicated,
  2640.                               but is acceptable to the KDC.
  2641.  
  2642.           11     HW-AUTHENT
  2643.                               This flag indicates  that  the  protocol
  2644.                               employed   for   initial  authentication
  2645.                               required the use of hardware expected to
  2646.                               be possessed solely by the named client.
  2647.                               The hardware  authentication  method  is
  2648.                               selected  by the KDC and the strength of
  2649.                               the method is not indicated.
  2650.  
  2651.           12-31  RESERVED
  2652.                               Reserved for future use.
  2653.  
  2654.  
  2655.  
  2656. key       This field  exists  in  the  ticket  and  the  KDC
  2657.           response  and is used to pass the session key from
  2658.           Kerberos to the application server and the client.
  2659.           The field's encoding is described in section 6.1.
  2660.  
  2661. crealm    This field contains the name of the realm in which
  2662.           the  client  is  registered  and  in which initial
  2663.           authentication took place.
  2664.  
  2665.  
  2666. cname     This field contains the name part of the  client's
  2667.           principal identifier.
  2668.  
  2669.  
  2670. transited This field lists the names of the Kerberos  realms
  2671.           that  took part in authenticating the user to whom
  2672.           this ticket was issued.  It does not  specify  the
  2673.           order  in  which  the  realms were transited.  See
  2674.           section 3.3.3.1 for  details  on  how  this  field
  2675.           encodes the traversed realms.
  2676.  
  2677.  
  2678. authtime  This field indicates the time of initial authenti-
  2679.           cation for the named principal.  It is the time of
  2680.           issue for the original ticket on which this ticket
  2681.           is based.  It is included in the ticket to provide
  2682.           additional information to the end service, and  to
  2683.           provide  the necessary information for implementa-
  2684.           tion of a `hot list' service at the KDC.   An  end
  2685.           service that is particularly paranoid could refuse
  2686.  
  2687.  
  2688. Section 5.3.1.             - 41 -   Expires 28 February 1993
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.                   Version 5 - Revision 5.1
  2696.  
  2697.  
  2698.           to accept tickets for which the initial  authenti-
  2699.           cation occurred "too far" in the past.
  2700.  
  2701.           This  field  is  also  returned  as  part  of  the
  2702.           response  from  the KDC.  When returned as part of
  2703.           the    response    to    initial    authentication
  2704.           (KRB_AS_REP), this is the current time on the Ker-
  2705.           beros server[21].
  2706.  
  2707.  
  2708. starttime This field in the ticket specifies the time  after
  2709.           which the ticket is valid.  Together with endtime,
  2710.           this field specifies the life of the  ticket.   If
  2711.           it  is absent from the ticket, its value should be
  2712.           treated as that of the authtime field.
  2713.  
  2714.  
  2715. endtime   This field  contains  the  time  after  which  the
  2716.           ticket  will not be honored (its expiration time).
  2717.           Note that individual services may place their  own
  2718.           limits  on  the  life  of  a ticket and may reject
  2719.           tickets which have not yet expired.  As such, this
  2720.           is  really  an  upper bound on the expiration time
  2721.           for the ticket.
  2722.  
  2723.  
  2724. renew-tillThis field is only present in  tickets  that  have
  2725.           the  RENEWABLE  flag  set  in the flags field.  It
  2726.           indicates the maximum endtime that may be included
  2727.           in  a  renewal.  It can be thought of as the abso-
  2728.           lute expiration time for the ticket, including all
  2729.           renewals.
  2730.  
  2731.  
  2732. caddr     This field in a ticket contains zero (if  omitted)
  2733.           or  more  (if  present) host addresses.  These are
  2734.           the addresses from which the ticket can  be  used.
  2735.           If  there are no addresses, the ticket can be used
  2736.           from any location.  The decision  by  the  KDC  to
  2737.           issue  or by the end server to accept zero-address
  2738.           tickets is a policy decision and is  left  to  the
  2739.           Kerberos  and end-service administrators; they may
  2740.           refuse to issue or accept such tickets.  The  sug-
  2741.           gested  and  default policy, however, is that such
  2742.           tickets will  only  be  issued  or  accepted  when
  2743. __________________________
  2744. [21] This time value might be used (at the  host's  op-
  2745. tion) to adjust the workstation's clock.  HOWEVER, this
  2746. is not recommended, since the client  cannot  determine
  2747. that  such  a  KRB_AS_REP actually came from the proper
  2748. KDC in a timely manner unless the enclosed  ticket  can
  2749. be  used  in  communication with a server whose secrets
  2750. are uncompromised.
  2751.  
  2752. Section 5.3.1.             - 42 -   Expires 28 February 1993
  2753.  
  2754.  
  2755.  
  2756.  
  2757.  
  2758.  
  2759.                   Version 5 - Revision 5.1
  2760.  
  2761.  
  2762.           additional information that can be  used  to  res-
  2763.           trict  the  use  of  the ticket is included in the
  2764.           authorization_data field.   Such  a  ticket  is  a
  2765.           capability.
  2766.  
  2767.           Network addresses are included in  the  ticket  to
  2768.           make  it  harder  for  an  attacker  to use stolen
  2769.           credentials.  Because the session key is not  sent
  2770.           over  the  network in cleartext, credentials can't
  2771.           be stolen simply by listening to the  network;  an
  2772.           attacker  has  to  gain  access to the session key
  2773.           (perhaps   through   operating   system   security
  2774.           breaches  or a careless user's unattended session)
  2775.           to make use of stolen tickets.
  2776.  
  2777.           It is important to note that the  network  address
  2778.           from  which  a  connection  is  received cannot be
  2779.           reliably determined.  Even  if  it  could  be,  an
  2780.           attacker who has compromised the client's worksta-
  2781.           tion  could  use  the  credentials   from   there.
  2782.           Including the network addresses only makes it more
  2783.           difficult, not impossible, for an attacker to walk
  2784.           off with stolen credentials and then use them from
  2785.           a "safe" location.
  2786.  
  2787.  
  2788. authorization-data
  2789.           The  authorization-data  field  is  used  to  pass
  2790.           authorization  data  from  the  principal on whose
  2791.           behalf a ticket was issued to the application ser-
  2792.           vice.   If no authorization data is included, this
  2793.           field will be left out.  The data  in  this  field
  2794.           are  specific  to the end service.  It is expected
  2795.           that the field will contain the names  of  service
  2796.           specific objects, and the rights to those objects.
  2797.           The format for this field is described in  section
  2798.           5.2.   Although Kerberos is not concerned with the
  2799.           format of the contents of the subfields,  it  does
  2800.           carry type information (ad-type).
  2801.  
  2802.           By using the authorization_data field, a principal
  2803.           is  able  to  issue  a  proxy  that is valid for a
  2804.           specific purpose.  For example, a  client  wishing
  2805.           to  print a file can obtain a file server proxy to
  2806.           be passed to the print server.  By specifying  the
  2807.           name  of the file in the authorization_data field,
  2808.           the file server knows that the  print  server  can
  2809.           only  use  the  client's rights when accessing the
  2810.           particular file to be printed.
  2811.  
  2812.           It is interesting to note that  if  one  specifies
  2813.           the authorization-data field of a proxy and leaves
  2814.           the host addresses blank, the resulting ticket and
  2815.           session  key  can be treated as a capability.  See
  2816.  
  2817.  
  2818. Section 5.3.1.             - 43 -   Expires 28 February 1993
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.                   Version 5 - Revision 5.1
  2826.  
  2827.  
  2828.           [9] for some suggested uses of this field.
  2829.  
  2830.           The authorization-data field is optional and  does
  2831.           not have to be included in a ticket.
  2832.  
  2833. _5._3._2.  _A_u_t_h_e_n_t_i_c_a_t_o_r_s
  2834.  
  2835.      An authenticator is a record sent with a  ticket  to  a
  2836. server  to  certify the client's knowledge of the encryption
  2837. key in the ticket, to help the server detect replays, and to
  2838. help  choose a "true session key" to use with the particular
  2839. session.  The encoding is encrypted in the ticket's  session
  2840. key shared by the client and the server:
  2841.  
  2842. -- Unencrypted authenticator
  2843. Authenticator ::=              [APPLICATION 2] SEQUENCE  {
  2844.                                authenticator-vno[0]          INTEGER,
  2845.                                crealm[1]                     Realm,
  2846.                                cname[2]                      PrincipalName,
  2847.                                cksum[3]                      Checksum OPTIONAL,
  2848.                                cusec[4]                      INTEGER,
  2849.                                ctime[5]                      KerberosTime,
  2850.                                subkey[6]                     EncryptionKey OPTIONAL,
  2851.                                seq-number[7]                 INTEGER OPTIONAL,
  2852.                                authorization-data[8]         AuthorizationData OPTIONAL
  2853. }
  2854.  
  2855.  
  2856. authenticator-vno
  2857.           This field specifies the version  number  for  the
  2858.           format of the authenticator.  This document speci-
  2859.           fies version 5.
  2860.  
  2861.  
  2862. crealm and cname
  2863.           These fields are the same as those  described  for
  2864.           the ticket in section 5.3.1.
  2865.  
  2866.  
  2867. cksum     This field contains a checksum of the the applica-
  2868.           tion data that accompanies the KRB_AP_REQ.
  2869.  
  2870.  
  2871. cusec     This field contains the microsecond  part  of  the
  2872.           client's timestamp.  Its value (before encryption)
  2873.           ranges from 0 to 999999.  It often  appears  along
  2874.           with  ctime.   The two fields are used together to
  2875.           specify a reasonably accurate timestamp.
  2876.  
  2877.  
  2878. ctime     This  field  contains  the  current  time  on  the
  2879.           client's host.
  2880.  
  2881.  
  2882.  
  2883.  
  2884. Section 5.3.2.             - 44 -   Expires 28 February 1993
  2885.  
  2886.  
  2887.  
  2888.  
  2889.  
  2890.  
  2891.                   Version 5 - Revision 5.1
  2892.  
  2893.  
  2894. subkey    This field contains the  client's  choice  for  an
  2895.           encryption key which is to be used to protect this
  2896.           specific application session.  Unless an  applica-
  2897.           tion  specifies  otherwise,  if this field is left
  2898.           out the session key from the ticket will be used.
  2899.  
  2900. seq-numberThis optional field includes the initial  sequence
  2901.           number to be used by the KRB_PRIV or KRB_SAFE mes-
  2902.           sages when sequence numbers  are  used  to  detect
  2903.           replays  (It  may  also  be  used  by  application
  2904.           specific messages).  When included in the  authen-
  2905.           ticator  this field specifies the initial sequence
  2906.           number for messages from the client to the server.
  2907.           When  included  in the AP-REP message, the initial
  2908.           sequence number is  that  for  messages  from  the
  2909.           server  to  the  client.  When used in KRB_PRIV or
  2910.           KRB_SAFE messages, it is incremented by one  after
  2911.           each message is sent.
  2912.  
  2913.           For sequence numbers  to  adequately  support  the
  2914.           detection of replays they should be non-repeating,
  2915.           even across connection  boundaries.   The  initial
  2916.           sequence  number  should  be  random and uniformly
  2917.           distributed across  the  full  space  of  possible
  2918.           sequence  numbers, so that it cannot be guessed by
  2919.           an attacker and so  that  it  and  the  successive
  2920.           sequence numbers do not repeat other sequences.
  2921.  
  2922.  
  2923. authorization-data
  2924.           This field is the same as described for the ticket
  2925.           in  section  5.3.1.   It is optional and will only
  2926.           appear when  additional  restrictions  are  to  be
  2927.           placed  on  the use of a ticket, beyond those car-
  2928.           ried in the ticket itself.
  2929.  
  2930. _5._4.  _S_p_e_c_i_f_i_c_a_t_i_o_n_s _f_o_r _t_h_e _A_S _a_n_d _T_G_S _e_x_c_h_a_n_g_e_s
  2931.  
  2932.      This section specifies the format of the messages  used
  2933. in exchange between the client and the Kerberos server.  The
  2934. format of possible error messages appears in section 5.8.1.
  2935.  
  2936. _5._4._1.  _K_R_B__K_D_C__R_E_Q _d_e_f_i_n_i_t_i_o_n
  2937.  
  2938.      The  KRB_KDC_REQ  message  has  no  type  of  its  own.
  2939. Instead,  its  type  is  one  of  KRB_AS_REQ  or KRB_TGS_REQ
  2940. depending on whether the request is for an initial ticket or
  2941. an  additional  ticket.  In either case, the message is sent
  2942. from the client to  the  Authentication  Server  to  request
  2943. credentials for a service.
  2944.  
  2945.      The message fields are:
  2946.  
  2947. AS-REQ ::=         [APPLICATION 10] KDC-REQ
  2948.  
  2949.  
  2950. Section 5.4.1.             - 45 -   Expires 28 February 1993
  2951.  
  2952.  
  2953.  
  2954.  
  2955.  
  2956.  
  2957.                   Version 5 - Revision 5.1
  2958.  
  2959.  
  2960. TGS-REQ ::=        [APPLICATION 12] KDC-REQ
  2961.  
  2962. KDC-REQ ::=        SEQUENCE {
  2963.                    pvno[1]                       INTEGER,
  2964.                    msg-type[2]                   INTEGER,
  2965.                    padata[3]                     SEQUENCE OF PA-DATA OPTIONAL,
  2966.                    req-body[4]                   KDC-REQ-BODY
  2967. }
  2968.  
  2969. PA-DATA ::=        SEQUENCE {
  2970.                    padata-type[1]                INTEGER,
  2971.                    padata-value[2]               OCTET STRING,
  2972.                                                  -- might be encoded AP-REQ
  2973. }
  2974.  
  2975. KDC-REQ-BODY ::=   SEQUENCE {
  2976.                     kdc-options[0]               KDCOptions,
  2977.                     cname[1]                     PrincipalName OPTIONAL,
  2978.                                                  -- Used only in AS-REQ
  2979.                     realm[2]                     Realm, -- Server's realm
  2980.                                                  -- Also client's in AS-REQ
  2981.                     sname[3]                     PrincipalName,
  2982.                     from[4]                      KerberosTime OPTIONAL,
  2983.                     till[5]                      KerberosTime,
  2984.                     rtime[6]                     KerberosTime OPTIONAL,
  2985.                     nonce[7]                     INTEGER,
  2986.                     etype[8]                     SEQUENCE OF INTEGER, -- EncryptionType,
  2987.                                                  -- in preference order
  2988.                     addresses[9]                 HostAddresses OPTIONAL,
  2989.                     enc-authorization-data[10]   EncryptedData OPTIONAL,
  2990.                                                  -- Encrypted AuthorizationData encoding
  2991.                     additional-tickets[11]       SEQUENCE OF Ticket OPTIONAL
  2992. }
  2993.  
  2994. The fields in this message are:
  2995.  
  2996.  
  2997. pvno      This field is included in each message, and speci-
  2998.           fies  the  protocol version number.  This document
  2999.           specifies protocol version 5.
  3000.  
  3001.  
  3002. msg-type  This field indicates the type of a  protocol  mes-
  3003.           sage.   It  will  almost always be the same as the
  3004.           application identifier associated with a  message.
  3005.           It is included to make the identifier more readily
  3006.           accessible to the application.   For  the  KDC-REQ
  3007.           message,   this   type   will   be  KRB_AS_REQ  or
  3008.           KRB_TGS_REQ.
  3009.  
  3010.  
  3011. padata    The padata (pre-authentication  data)  field  con-
  3012.           tains  a  sequence  of  authentication information
  3013.           which may be  needed  before  credentials  can  be
  3014.  
  3015.  
  3016. Section 5.4.1.             - 46 -   Expires 28 February 1993
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.                   Version 5 - Revision 5.1
  3024.  
  3025.  
  3026.           issued  or decrypted.  In the case of requests for
  3027.           additional tickets (KRB_TGS_REQ), this field  will
  3028.           include  an element with padata-type of PA-TGS-REQ
  3029.           and data  of  an  authentication  header  (ticket-
  3030.           granting  ticket and authenticator).  The checksum
  3031.           in the authenticator  (which  must  be  collision-
  3032.           proof)  is  to  be  computed over the KDC-REQ-BODY
  3033.           encoding.  In most requests for initial  authenti-
  3034.           cation  (KRB_AS_REQ)  and  most replies (KDC-REP),
  3035.           the padata field will be left out.  This field may
  3036.           also  contain information needed by certain exten-
  3037.           sions to the Kerberos protocol.  For  example,  it
  3038.           might  be used to initially verify the identity of
  3039.           a client before any response is  returned,  or  it
  3040.           might  contain  information needed to help the KDC
  3041.           or the client select the key needed for generating
  3042.           or  decrypting  the  response.   The  latter cases
  3043.           would be useful for supporting the use of  certain
  3044.           "smartcards"  with  Kerberos.  The details of such
  3045.           extensions are not presently specified.
  3046.  
  3047.  
  3048. padata-type
  3049.           The padata-type element of the padata field  indi-
  3050.           cates  the way that the padata-value element is to
  3051.           be interpreted.  Negative  values  of  padata-type
  3052.           are  reserved  for  unregistered use; non-negative
  3053.           values are used for a registered interpretation of
  3054.           the element type.
  3055.  
  3056.  
  3057. req-body  This field is a placeholder delimiting the  extent
  3058.           of  the  remaining fields.  If a checksum is to be
  3059.           calculated over the request, it is calculated over
  3060.           an  encoding of the KDC-REQ-BODY sequence which is
  3061.           enclosed within the req-body field.
  3062.  
  3063.  
  3064. kdc-options
  3065.           This  field  appears   in   the   KRB_AS_REQ   and
  3066.           KRB_TGS_REQ  requests to the KDC and indicates the
  3067.           flags that the client wants set on the tickets  as
  3068.           well  as  other  information that is to modify the
  3069.           behavior of the KDC.  Where appropriate, the  name
  3070.           of  an  option may be the same as the flag that is
  3071.           set by that option.  Although in  most  case,  the
  3072.           bit  in the options field will be the same as that
  3073.           in the flags field, this is not guaranteed, so  it
  3074.           is not acceptable to simply copy the options field
  3075.           to the flags field.  There are various checks that
  3076.           must be made before honoring an option anyway.
  3077.  
  3078.           The kdc_options field is a  bit-field,  where  the
  3079.           selected  options  are  indicated by the bit being
  3080.  
  3081.  
  3082. Section 5.4.1.             - 47 -   Expires 28 February 1993
  3083.  
  3084.  
  3085.  
  3086.  
  3087.  
  3088.  
  3089.                   Version 5 - Revision 5.1
  3090.  
  3091.  
  3092.           set (1), and the unselected options  and  reserved
  3093.           fields  being reset (0).  The encoding of the bits
  3094.           is specified in  section  5.2.   The  options  are
  3095.           described  in more detail above in section 2.  The
  3096.           meanings of the options are:
  3097.  
  3098.           _B_i_t(_s)_N_a_m_e           _D_e_s_c_r_i_p_t_i_o_n
  3099.  
  3100.           0     RESERVED
  3101.                                Reserved for future  expansion  of  this
  3102.                                field.
  3103.  
  3104.           1     FORWARDABLE
  3105.                                The FORWARDABLE  option  indicates  that
  3106.                                the  ticket  to be issued is to have its
  3107.                                forwardable flag set.  It  may  only  be
  3108.                                set on the initial request, or in a sub-
  3109.                                sequent request if  the  ticket-granting
  3110.                                ticket on which it is based is also for-
  3111.                                wardable.
  3112.  
  3113.           2     FORWARDED
  3114.                                The FORWARDED option is  only  specified
  3115.                                in  a  request  to  the  ticket-granting
  3116.                                server and will only be honored  if  the
  3117.                                ticket-granting  ticket  in  the request
  3118.                                has  its  FORWARDABLE  bit  set.    This
  3119.                                option  indicates that this is a request
  3120.                                for forwarding.  The address(es) of  the
  3121.                                host  from which the resulting ticket is
  3122.                                to  be  valid  are   included   in   the
  3123.                                addresses field of the request.
  3124.  
  3125.           3     PROXIABLE
  3126.                                The PROXIABLE option indicates that  the
  3127.                                ticket to be issued is to have its prox-
  3128.                                iable flag set.  It may only be  set  on
  3129.                                the  initial request, or in a subsequent
  3130.                                request if the ticket-granting ticket on
  3131.                                which it is based is also proxiable.
  3132.  
  3133.           4     PROXY
  3134.                                The PROXY option indicates that this  is
  3135.                                a request for a proxy.  This option will
  3136.                                only be honored if  the  ticket-granting
  3137.                                ticket  in the request has its PROXIABLE
  3138.                                bit set.  The address(es)  of  the  host
  3139.                                from which the resulting ticket is to be
  3140.                                valid  are  included  in  the  addresses
  3141.                                field of the request.
  3142.  
  3143.           5     ALLOW-POSTDATE
  3144.                                The ALLOW-POSTDATE option indicates that
  3145.                                the  ticket  to be issued is to have its
  3146.                                MAY-POSTDATE flag set.  It may  only  be
  3147.                                set on the initial request, or in a sub-
  3148.                                sequent request if  the  ticket-granting
  3149.                                ticket on which it is based also has its
  3150.                                MAY-POSTDATE flag set.
  3151.  
  3152.  
  3153.  
  3154. Section 5.4.1.             - 48 -   Expires 28 February 1993
  3155.  
  3156.  
  3157.  
  3158.  
  3159.  
  3160.  
  3161.                   Version 5 - Revision 5.1
  3162.  
  3163.  
  3164.           6     POSTDATED
  3165.                                The POSTDATED option indicates that this
  3166.                                is  a  request  for  a postdated ticket.
  3167.                                This option will only be honored if  the
  3168.                                ticket-granting  ticket  on  which it is
  3169.                                based has  its  MAY-POSTDATE  flag  set.
  3170.                                The  resulting ticket will also have its
  3171.                                INVALID flag set, and that flag  may  be
  3172.                                reset by a subsequent request to the KDC
  3173.                                after the starttime in  the  ticket  has
  3174.                                been reached.
  3175.  
  3176.           7     UNUSED
  3177.                                This option is presently unused.
  3178.  
  3179.           8     RENEWABLE
  3180.                                The RENEWABLE option indicates that  the
  3181.                                ticket  to  be  issued  is  to  have its
  3182.                                RENEWABLE flag set.  It may only be  set
  3183.                                on  the  initial  request,  or  when the
  3184.                                ticket-granting  ticket  on  which   the
  3185.                                request  is based is also renewable.  If
  3186.                                this option is requested, then the rtime
  3187.                                field   in   the  request  contains  the
  3188.                                desired absolute expiration time for the
  3189.                                ticket.
  3190.  
  3191.           9-26  RESERVED
  3192.                                Reserved for future use.
  3193.  
  3194.           27    RENEWABLE-OK
  3195.                                The RENEWABLE-OK option indicates that a
  3196.                                renewable ticket will be acceptable if a
  3197.                                ticket with the  requested  life  cannot
  3198.                                otherwise be provided.  If a ticket with
  3199.                                the requested life cannot  be  provided,
  3200.                                then  a  renewable  ticket may be issued
  3201.                                with  a  renew-till  equal  to  the  the
  3202.                                requested  endtime.   The  value  of the
  3203.                                renew-till field may still be limited by
  3204.                                local  limits, or limits selected by the
  3205.                                individual principal or server.
  3206.  
  3207.           28    ENC-TKT-IN-SKEY
  3208.                                This option is used only by the  ticket-
  3209.                                granting  service.   The ENC-TKT-IN-SKEY
  3210.                                option indicates that the ticket for the
  3211.                                end  server  is  to  be encrypted in the
  3212.                                session key from the additional  ticket-
  3213.                                granting ticket provided.
  3214.  
  3215.           29    RESERVED
  3216.                                Reserved for future use.
  3217.  
  3218.  
  3219.  
  3220.  
  3221.  
  3222.  
  3223.  
  3224.  
  3225.  
  3226.  
  3227. Section 5.4.1.             - 49 -   Expires 28 February 1993
  3228.  
  3229.  
  3230.  
  3231.  
  3232.  
  3233.  
  3234.                   Version 5 - Revision 5.1
  3235.  
  3236.  
  3237.           30    RENEW
  3238.                                This option is used only by the  ticket-
  3239.                                granting   service.   The  RENEW  option
  3240.                                indicates that the  present  request  is
  3241.                                for  a  renewal.  The ticket provided is
  3242.                                encrypted in  the  secret  key  for  the
  3243.                                server  on  which  it  is  valid.   This
  3244.                                option  will  only  be  honored  if  the
  3245.                                ticket  to  be renewed has its RENEWABLE
  3246.                                flag set and if the time in  its  renew-
  3247.                                till  field  has not passed.  The ticket
  3248.                                to be renewed is passed  in  the  padata
  3249.                                field  as  part  of  the  authentication
  3250.                                header.
  3251.  
  3252.           31    VALIDATE
  3253.                                This option is used only by the  ticket-
  3254.                                granting  service.   The VALIDATE option
  3255.                                indicates that the request is  to  vali-
  3256.                                date  a  postdated ticket.  It will only
  3257.                                be honored if the  ticket  presented  is
  3258.                                postdated,  presently  has  its  INVALID
  3259.                                flag set, and would be otherwise  usable
  3260.                                at  this time.  A ticket cannot be vali-
  3261.                                dated before its starttime.  The  ticket
  3262.                                presented for validation is encrypted in
  3263.                                the key of the server for  which  it  is
  3264.                                valid  and is passed in the padata field
  3265.                                as part of the authentication header.
  3266.  
  3267.  
  3268.  
  3269. cname and sname
  3270.           These fields are the same as those  described  for
  3271.           the ticket in section 5.3.1.
  3272.  
  3273.  
  3274. enc-authorization-data
  3275.           The enc-authorization-data, if present (and it can
  3276.           only be present in the TGS_REQ form), is an encod-
  3277.           ing of the  desired  authorization-data  encrypted
  3278.           under  the  sub-session  key  if  present  in  the
  3279.           Authenticator, or alternatively from  the  session
  3280.           key  in  the ticket-granting ticket, both from the
  3281.           padata field in the KRB_AP_REQ.
  3282.  
  3283.  
  3284. realm     This  field  specifies  the  realm  part  of   the
  3285.           server's   principal   identifier.    In   the  AS
  3286.           exchange, this is  also  the  realm  part  of  the
  3287.           client's principal identifier.
  3288.  
  3289.  
  3290. from      This field  is  included  in  the  KRB_AS_REQ  and
  3291.           KRB_TGS_REQ  ticket  requests  when  the requested
  3292.           ticket  is  to  be  postdated.  It  specifies  the
  3293.  
  3294.  
  3295. Section 5.4.1.             - 50 -   Expires 28 February 1993
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.                   Version 5 - Revision 5.1
  3303.  
  3304.  
  3305.           desired start time for the requested ticket.
  3306.  
  3307.  
  3308.  
  3309. till      This field contains the expiration date  requested
  3310.           by the client in a ticket request.
  3311.  
  3312.  
  3313. rtime     This field is the requested renew-till  time  sent
  3314.           from  a client to the KDC in a ticket request.  It
  3315.           is optional.
  3316.  
  3317.  
  3318. nonce     This  field  is  part  of  the  KDC  request   and
  3319.           response.   It it intended to hold a random number
  3320.           generated by the client.  If the  same  number  is
  3321.           included  in  the encrypted response from the KDC,
  3322.           it provides evidence that the  response  is  fresh
  3323.           and  has not been replayed by an attacker.  Nonces
  3324.           must never be re-used.  Ideally, it should be gen-
  3325.           erated randomly, but if the correct time is known,
  3326.           it may suffice[22].
  3327.  
  3328.  
  3329. etype     This field specifies the desired encryption  algo-
  3330.           rithm to be used in the response.
  3331.  
  3332.  
  3333. addresses This field is included in the initial request  for
  3334.           tickets,  and  optionally included in requests for
  3335.           additional  tickets   from   the   ticket-granting
  3336.           server.  It specifies the addresses from which the
  3337.           requested ticket is  to  be  valid.   Normally  it
  3338.           includes  the addresses for the client's host.  If
  3339.           a proxy is  requested,  this  field  will  contain
  3340.           other  addresses.   The contents of this field are
  3341.           usually copied by the KDC into the caddr field  of
  3342.           the resulting ticket.
  3343.  
  3344.  
  3345. additional-tickets
  3346.           Additional tickets may be optionally included in a
  3347.           request  to  the  ticket-granting  server.  If the
  3348.           ENC-TKT-IN-SKEY option has  been  specified,  then
  3349.           the session key from the additional ticket will be
  3350.           used in place of the server's key to  encrypt  the
  3351.           new   ticket.   If  more  than  one  option  which
  3352. __________________________
  3353. [22] Note, however, that if the time  is  used  as  the
  3354. nonce,  one must make sure that the workstation time is
  3355. monotonically increasing.  If the time  is  ever  reset
  3356. backwards,  there  is  a small, but finite, probability
  3357. that a nonce will be reused.
  3358.  
  3359. Section 5.4.1.             - 51 -   Expires 28 February 1993
  3360.  
  3361.  
  3362.  
  3363.  
  3364.  
  3365.  
  3366.                   Version 5 - Revision 5.1
  3367.  
  3368.  
  3369.           requires additional tickets  has  been  specified,
  3370.           then  the additional tickets are used in the order
  3371.           specified by the ordering of the options bits (see
  3372.           kdc-options, above).
  3373.  
  3374.  
  3375.      The application code will be either ten (10) or  twelve
  3376. (12)  depending  on  whether  the  request is for an initial
  3377. ticket (AS-REQ) or for an additional ticket (TGS-REQ).
  3378.  
  3379.      The optional fields (addresses, authorization-data  and
  3380. additional-tickets)  are  only included if necessary to per-
  3381. form the operation specified in the kdc-options field.
  3382.  
  3383.      It should be noted that in  KRB_TGS_REQ,  the  protocol
  3384. version number appears twice and two different message types
  3385. appear:  the KRB_TGS_REQ message contains  these  fields  as
  3386. does  the  authentication header (KRB_AP_REQ) that is passed
  3387. in the padata field.
  3388.  
  3389. _5._4._2.  _K_R_B__K_D_C__R_E_P _d_e_f_i_n_i_t_i_o_n
  3390.  
  3391.      The KRB_KDC_REP message format is used  for  the  reply
  3392. from  the KDC for either an initial (AS) request or a subse-
  3393. quent  (TGS)  request.   There  is  no  message   type   for
  3394. KRB_KDC_REP.  Instead, the type will be either KRB_AS_REP or
  3395. KRB_TGS_REP.  The key used to encrypt the ciphertext part of
  3396. the  reply depends on the message type.  For KRB_AS_REP, the
  3397. ciphertext is encrypted in the client's secret key, and  the
  3398. client's  key  version number is included in the key version
  3399. number for the encrypted data.  For KRB_TGS_REP, the cipher-
  3400. text  is encrypted in the sub-session key from the Authenti-
  3401. cator, or if  absent,  the  session  key  from  the  ticket-
  3402. granting  ticket used in the request.  In that case, no ver-
  3403. sion number will be present in the EncryptedData sequence.
  3404.  
  3405.      The KRB_KDC_REP message contains the following fields:
  3406.  
  3407. AS-REP ::=    [APPLICATION 11] KDC-REP
  3408. TGS-REP ::=   [APPLICATION 13] KDC-REP
  3409.  
  3410. KDC-REP ::=   SEQUENCE {
  3411.               pvno[0]                    INTEGER,
  3412.               msg-type[1]                INTEGER,
  3413.               padata[2]                  SEQUENCE OF PA-DATA OPTIONAL,
  3414.               crealm[3]                  Realm,
  3415.               cname[4]                   PrincipalName,
  3416.               ticket[5]                  Ticket,
  3417.               enc-part[6]                EncryptedData
  3418. }
  3419.  
  3420.  
  3421. __________________________
  3422. [24] An application code in the  encrypted  part  of  a
  3423.  
  3424. Section 5.4.2.             - 52 -   Expires 28 February 1993
  3425.  
  3426.  
  3427.  
  3428.  
  3429.  
  3430.  
  3431.                   Version 5 - Revision 5.1
  3432.  
  3433.  
  3434.  
  3435. EncASRepPart ::=    [APPLICATION 25[24]] EncKDCRepPart
  3436. EncTGSRepPart ::=   [APPLICATION 26] EncKDCRepPart
  3437.  
  3438. EncKDCRepPart ::=   SEQUENCE {
  3439.                     key[0]                               EncryptionKey,
  3440.                     last-req[1]                          LastReq,
  3441.                     nonce[2]                             INTEGER,
  3442.                     key-expiration[3]                    KerberosTime OPTIONAL,
  3443.                     flags[4]                             TicketFlags,
  3444.                     authtime[5]                          KerberosTime,
  3445.                     starttime[6]                         KerberosTime OPTIONAL,
  3446.                     endtime[7]                           KerberosTime,
  3447.                     renew-till[8]                        KerberosTime OPTIONAL,
  3448.                     srealm[9]                            Realm,
  3449.                     sname[10]                            PrincipalName,
  3450.                     caddr[11]                            HostAddresses OPTIONAL
  3451. }
  3452.  
  3453.  
  3454. pvno and msg-type
  3455.           These fields are described above in section 5.4.1.
  3456.           msg-type is either KRB_AS_REP or KRB_TGS_REP.
  3457.  
  3458.  
  3459. padata    This field is described in detail above.  One pos-
  3460.           sible use for this field is to encode an alternate
  3461.           "mix-in" string to be used  with  a  string-to-key
  3462.           algorithm  (such  as is described in 6.3.2).  This
  3463.           ability is useful to ease transitions if  a  realm
  3464.           name  needs  to  change  (e.g.  when  a company is
  3465.           acquired); in such a case all  existing  password-
  3466.           derived  entries  in  the  KDC  database  would be
  3467.           flagged as needing a special mix-in  string  until
  3468.           the next password change.
  3469.  
  3470.  
  3471. crealm, cname, srealm and sname
  3472.           These fields are the same as those  described  for
  3473.           the ticket in section 5.3.1.
  3474.  
  3475.  
  3476. ticket    The newly-issued ticket, from section 5.3.1.
  3477.  
  3478.  
  3479. enc-part  This field is a place holder  for  the  ciphertext
  3480.           and  related  information that forms the encrypted
  3481.           part  of  a  message.   The  description  of   the
  3482.           encrypted part of the message follows each appear-
  3483.           ance of this field.  The encrypted part is encoded
  3484. __________________________
  3485. message  provides  an additional check that the message
  3486. was decrypted properly.
  3487.  
  3488.  
  3489.  
  3490. Section 5.4.2.             - 53 -   Expires 28 February 1993
  3491.  
  3492.  
  3493.  
  3494.  
  3495.  
  3496.  
  3497.                   Version 5 - Revision 5.1
  3498.  
  3499.  
  3500.           as described in section 6.1.
  3501.  
  3502.  
  3503. key       This field is the same as described for the ticket
  3504.           in section 5.3.1.
  3505.  
  3506.  
  3507. last-req  This field is returned by the  KDC  and  specifies
  3508.           the  time(s)  of  the last request by a principal.
  3509.           Depending on what information is  available,  this
  3510.           might  be  the  last  time  that  a  request for a
  3511.           ticket-granting ticket was made, or the last  time
  3512.           that  a  request based on a ticket-granting ticket
  3513.           was successful.  It also might cover  all  servers
  3514.           for  a realm, or just the particular server.  Some
  3515.           implementations may display  this  information  to
  3516.           the user to aid in discovering unauthorized use of
  3517.           one's identity.  It is similar in  spirit  to  the
  3518.           last   login  time  displayed  when  logging  into
  3519.           timesharing systems.
  3520.  
  3521.  
  3522. nonce     This field is described above in section 5.4.1.
  3523.  
  3524.  
  3525. key-expiration
  3526.           The key-expiration field is part of  the  response
  3527.           from  the  KDC  and  specifies  the  time that the
  3528.           client's secret key is due to expire.  The expira-
  3529.           tion  might  be the result of password aging or an
  3530.           account expiration.  This field  will  usually  be
  3531.           left  out  of  the TGS reply since the response to
  3532.           the TGS request is encrypted in a session key  and
  3533.           no  client  information need be retrieved from the
  3534.           KDC database.  It is up to the application  client
  3535.           (usually  the  login  program) to take appropriate
  3536.           action (such as notifying the user) if the expira-
  3537.           tion time is imminent.
  3538.  
  3539.  
  3540. flags, authtime, starttime, endtime, renew-till and caddr
  3541.           These fields are duplicates of those found in  the
  3542.           encrypted portion of the attached ticket (see sec-
  3543.           tion 5.3.1), provided so  the  client  may  verify
  3544.           they  match  the intended request and to assist in
  3545.           proper ticket caching.  If the message is of  type
  3546.           KRB_TGS_REP,  the  caddr field will only be filled
  3547.           in if the request was for  a  proxy  or  forwarded
  3548.           ticket, or if the user is substituting a subset of
  3549.           the addresses from the ticket granting ticket.  If
  3550.           the  client-requested addresses are not present or
  3551.           not used, then  the  addresses  contained  in  the
  3552.           ticket  will  be the same as those included in the
  3553.           ticket-granting ticket.
  3554.  
  3555.  
  3556. Section 5.4.2.             - 54 -   Expires 28 February 1993
  3557.  
  3558.  
  3559.  
  3560.  
  3561.  
  3562.  
  3563.                   Version 5 - Revision 5.1
  3564.  
  3565.  
  3566. _5._5.  _C_l_i_e_n_t/_S_e_r_v_e_r (_C_S) _m_e_s_s_a_g_e _s_p_e_c_i_f_i_c_a_t_i_o_n_s
  3567.  
  3568.      This section specifies the format of the messages  used
  3569. for  the  authentication  of  the  client to the application
  3570. server.
  3571.  
  3572. _5._5._1.  _K_R_B__A_P__R_E_Q _d_e_f_i_n_i_t_i_o_n
  3573.  
  3574.      The KRB_AP_REQ message contains the  Kerberos  protocol
  3575. version  number,  the  message  type  KRB_AP_REQ, an options
  3576. field to indicate any options in use,  and  the  ticket  and
  3577. authenticator  themselves.   The KRB_AP_REQ message is often
  3578. referred to as the "authentication header".
  3579.  
  3580. AP-REQ ::=      [APPLICATION 14] SEQUENCE {
  3581.                 pvno[0]                       INTEGER,
  3582.                 msg-type[1]                   INTEGER,
  3583.                 ap-options[2]                 APOptions,
  3584.                 ticket[3]                     Ticket,
  3585.                 authenticator[4]              EncryptedData
  3586. }
  3587.  
  3588. APOptions ::=   BIT STRING {
  3589.                 reserved(0),
  3590.                 use-session-key(1),
  3591.                 mutual-required(2)
  3592. }
  3593.  
  3594.  
  3595. pvno and msg-type
  3596.           These fields are described above in section 5.4.1.
  3597.           msg-type is KRB_AP_REQ.
  3598.  
  3599.  
  3600. ap-optionsThis field  appears  in  the  application  request
  3601.           (KRB_AP_REQ)  and  affects  the way the request is
  3602.           processed.  It is a bit-field, where the  selected
  3603.           options  are  indicated  by the bit being set (1),
  3604.           and the unselected  options  and  reserved  fields
  3605.           being  reset  (0).   The  encoding  of the bits is
  3606.           specified in section 5.2.   The  meanings  of  the
  3607.           options are:
  3608.  
  3609.           _B_i_t(_s)_N_a_m_e           _D_e_s_c_r_i_p_t_i_o_n
  3610.  
  3611.           0     RESERVED
  3612.                                Reserved for future  expansion  of  this
  3613.                                field.
  3614.  
  3615.  
  3616.  
  3617.  
  3618.  
  3619.  
  3620.  
  3621.  
  3622.  
  3623. Section 5.5.1.             - 55 -   Expires 28 February 1993
  3624.  
  3625.  
  3626.  
  3627.  
  3628.  
  3629.  
  3630.                   Version 5 - Revision 5.1
  3631.  
  3632.  
  3633.           1     USE-SESSION-KEY
  3634.                                The  USE-SESSION-KEY  option   indicates
  3635.                                that the ticket the client is presenting
  3636.                                to a server is encrypted in the  session
  3637.                                key  from  the  server's ticket-granting
  3638.                                ticket.  When this option is not  speci-
  3639.                                fied,  the  ticket  is  encrypted in the
  3640.                                server's secret key.
  3641.  
  3642.           2     MUTUAL-REQUIRED
  3643.                                The  MUTUAL-REQUIRED  option  tells  the
  3644.                                server  that  the client requires mutual
  3645.                                authentication, and that it must respond
  3646.                                with a KRB_AP_REP message.
  3647.  
  3648.           3-31  RESERVED
  3649.                                Reserved for future use.
  3650.  
  3651.  
  3652.  
  3653. ticket    This field is a ticket authenticating  the  client
  3654.           to the server.
  3655.  
  3656.  
  3657. authenticator
  3658.           This contains the  authenticator,  which  includes
  3659.           the  client's choice of a subkey.  Its encoding is
  3660.           described in section 5.3.2.
  3661.  
  3662. _5._5._2.  _K_R_B__A_P__R_E_P _d_e_f_i_n_i_t_i_o_n
  3663.  
  3664.      The KRB_AP_REP message contains the  Kerberos  protocol
  3665. version  number,  the  message  type, and an encrypted time-
  3666. stamp.  The message is sent in in response to an application
  3667. request  (KRB_AP_REQ) where the mutual authentication option
  3668. has been selected in the ap-options field.
  3669.  
  3670. AP-REP ::=         [APPLICATION 15] SEQUENCE {
  3671.                    pvno[0]                           INTEGER,
  3672.                    msg-type[1]                       INTEGER,
  3673.                    enc-part[2]                       EncryptedData
  3674. }
  3675.  
  3676. EncAPRepPart ::=   [APPLICATION 27[26]] SEQUENCE {
  3677.                    ctime[0]                          KerberosTime,
  3678.                    cusec[1]                          INTEGER,
  3679.                    subkey[2]                         EncryptionKey OPTIONAL,
  3680.                    seq-number[3]                     INTEGER OPTIONAL
  3681. }
  3682.  
  3683. The encoded EncAPRepPart is encrypted in the shared  session
  3684. key of the ticket.  The optional subkey field can be used in
  3685. __________________________
  3686. [26] An application code in the  encrypted  part  of  a
  3687. message  provides  an additional check that the message
  3688. was decrypted properly.
  3689.  
  3690. Section 5.5.2.             - 56 -   Expires 28 February 1993
  3691.  
  3692.  
  3693.  
  3694.  
  3695.  
  3696.  
  3697.                   Version 5 - Revision 5.1
  3698.  
  3699.  
  3700. an application-arranged negotiation to choose a per associa-
  3701. tion session key.
  3702.  
  3703.  
  3704. pvno and msg-type
  3705.           These fields are described above in section 5.4.1.
  3706.           msg-type is KRB_AP_REP.
  3707.  
  3708.  
  3709. enc-part  This field is described above in section 5.4.2.
  3710.  
  3711.  
  3712. ctime     This  field  contains  the  current  time  on  the
  3713.           client's host.
  3714.  
  3715.  
  3716. cusec     This field contains the microsecond  part  of  the
  3717.           client's timestamp.
  3718.  
  3719.  
  3720. subkey    This field contains an encryption key which is  to
  3721.           be  used to protect this specific application ses-
  3722.           sion.  See section 3.2.6 for specifics on how this
  3723.           field  is  used  to  negotiate  a  key.  Unless an
  3724.           application specifies otherwise, if this field  is
  3725.           left out, the sub-session key from the authentica-
  3726.           tor, or if also left out, the session key from the
  3727.           ticket will be used.
  3728.  
  3729.  
  3730. _5._5._3.  _E_r_r_o_r _m_e_s_s_a_g_e _r_e_p_l_y
  3731.  
  3732.      If an error occurs  while  processing  the  application
  3733. request,  the  KRB_ERROR  message  will be sent in response.
  3734. See section 5.8.1 for the format of the error message.   The
  3735. cname and crealm fields may be left out if the server cannot
  3736. determine their appropriate values  from  the  corresponding
  3737. KRB_AP_REQ  message.  If the authenticator was decipherable,
  3738. the ctime and cusec fields will contain the values from it.
  3739.  
  3740. _5._6.  _K_R_B__S_A_F_E _m_e_s_s_a_g_e _s_p_e_c_i_f_i_c_a_t_i_o_n
  3741.  
  3742.      This section specifies the format of a message that can
  3743. be  used by either side (client or server) of an application
  3744. to send a tamper-proof message to  its  peer.   It  presumes
  3745. that  a session key has previously been exchanged (for exam-
  3746. ple, by using the KRB_AP_REQ/KRB_AP_REP messages).
  3747.  
  3748. _5._6._1.  _K_R_B__S_A_F_E _d_e_f_i_n_i_t_i_o_n
  3749.  
  3750.      The KRB_SAFE message contains user data  along  with  a
  3751. collision-proof  checksum  keyed  with the session key.  The
  3752. message fields are:
  3753.  
  3754.  
  3755.  
  3756. Section 5.6.1.             - 57 -   Expires 28 February 1993
  3757.  
  3758.  
  3759.  
  3760.  
  3761.  
  3762.  
  3763.                   Version 5 - Revision 5.1
  3764.  
  3765.  
  3766. KRB-SAFE ::=        [APPLICATION 20] SEQUENCE {
  3767.                     pvno[0]                       INTEGER,
  3768.                     msg-type[1]                   INTEGER,
  3769.                     safe-body[2]                  KRB-SAFE-BODY,
  3770.                     cksum[3]                      Checksum
  3771. }
  3772.  
  3773. KRB-SAFE-BODY ::=   SEQUENCE {
  3774.                     user-data[0]                  OCTET STRING,
  3775.                     timestamp[1]                  KerberosTime OPTIONAL,
  3776.                     usec[2]                       INTEGER OPTIONAL,
  3777.                     seq-number[3]                 INTEGER OPTIONAL,
  3778.                     s-address[4]                  HostAddress,
  3779.                     r-address[5]                  HostAddress OPTIONAL
  3780. }
  3781.  
  3782.  
  3783.  
  3784.  
  3785. pvno and msg-type
  3786.           These fields are described above in section 5.4.1.
  3787.           msg-type is KRB_SAFE.
  3788.  
  3789.  
  3790. safe-body This field is a placeholder for the  body  of  the
  3791.           KRB-SAFE  message.  It is to be encoded separately
  3792.           and then have the checksum computed over  it,  for
  3793.           use in the cksum field.
  3794.  
  3795.  
  3796. cksum     This field contains the checksum of  the  applica-
  3797.           tion data.  Checksum details are described in sec-
  3798.           tion 6.4.   The  checksum  is  computed  over  the
  3799.           encoding of the KRB-SAFE-BODY sequence.
  3800.  
  3801.  
  3802. user-data This field is part of the  KRB_SAFE  and  KRB_PRIV
  3803.           messages and contain the application specific data
  3804.           that is being passed from the sender to the  reci-
  3805.           pient.
  3806.  
  3807.  
  3808. timestamp This field is part of the  KRB_SAFE  and  KRB_PRIV
  3809.           messages.   Its  contents  are the current time as
  3810.           known by the sender of the message.   By  checking
  3811.           the  timestamp,  the  recipient  of the message is
  3812.           able to make sure that it was recently  generated,
  3813.           and is not a replay.
  3814.  
  3815.  
  3816. usec      This field is part of the  KRB_SAFE  and  KRB_PRIV
  3817.           headers.   It contains the microsecond part of the
  3818.           timestamp.
  3819.  
  3820.  
  3821.  
  3822. Section 5.6.1.             - 58 -   Expires 28 February 1993
  3823.  
  3824.  
  3825.  
  3826.  
  3827.  
  3828.  
  3829.                   Version 5 - Revision 5.1
  3830.  
  3831.  
  3832. seq-number
  3833.           This field is described above in section 5.3.2.
  3834.  
  3835.  
  3836. s-address This field specifies the address  in  use  by  the
  3837.           sender of the message.
  3838.  
  3839.  
  3840. r-address This field specifies the address  in  use  by  the
  3841.           recipient  of  the message.  It may be omitted for
  3842.           some uses (such as broadcast protocols),  but  the
  3843.           recipient  may  arbitrarily  reject such messages.
  3844.           This field along with s-address  can  be  used  to
  3845.           help  detect  messages which have been incorrectly
  3846.           or maliciously delivered to the wrong recipient.
  3847.  
  3848. _5._7.  _K_R_B__P_R_I_V _m_e_s_s_a_g_e _s_p_e_c_i_f_i_c_a_t_i_o_n
  3849.  
  3850.      This section specifies the format of a message that can
  3851. be  used by either side (client or server) of an application
  3852. to securely and privately send a message to  its  peer.   It
  3853. presumes  that  a  session key has previously been exchanged
  3854. (for example, by using the KRB_AP_REQ/KRB_AP_REP messages).
  3855.  
  3856. _5._7._1.  _K_R_B__P_R_I_V _d_e_f_i_n_i_t_i_o_n
  3857.  
  3858.      The KRB_PRIV message contains user  data  encrypted  in
  3859. the Session Key.  The message fields are:
  3860.  
  3861. KRB-PRIV ::=         [APPLICATION 21] SEQUENCE {
  3862.                      pvno[0]                           INTEGER,
  3863.                      msg-type[1]                       INTEGER,
  3864.                      enc-part[3]                       EncryptedData
  3865. }
  3866.  
  3867. EncKrbPrivPart ::=   [APPLICATION 28[28]] SEQUENCE {
  3868.                      user-data[0]                      OCTET STRING,
  3869.                      timestamp[1]                      KerberosTime OPTIONAL,
  3870.                      usec[2]                           INTEGER OPTIONAL,
  3871.                      seq-number[3]                     INTEGER OPTIONAL,
  3872.                      s-address[4]                      HostAddress, -- sender's addr
  3873.                      r-address[5]                      HostAddress OPTIONAL -- recip's addr
  3874. }
  3875.  
  3876.  
  3877.  
  3878. pvno and msg-type
  3879.           These fields are described above in section 5.4.1.
  3880.           msg-type is KRB_PRIV.
  3881. __________________________
  3882. [28] An application code in the  encrypted  part  of  a
  3883. message  provides  an additional check that the message
  3884. was decrypted properly.
  3885.  
  3886. Section 5.7.1.             - 59 -   Expires 28 February 1993
  3887.  
  3888.  
  3889.  
  3890.  
  3891.  
  3892.  
  3893.                   Version 5 - Revision 5.1
  3894.  
  3895.  
  3896. enc-part  This field holds an encoding of the EncKrbPrivPart
  3897.           sequence  encrypted  under  the  session  key[29].
  3898.           This  encrypted  encoding is used for the enc-part
  3899.           field of the KRB-PRIV message.  See section 6  for
  3900.           the format of the ciphertext.
  3901.  
  3902.  
  3903. user-data, timestamp, usec, s-address and r-address
  3904.           These fields are described above in section 5.6.1.
  3905.  
  3906.  
  3907. seq-number
  3908.           This field is described above in section 5.3.2.
  3909.  
  3910. _5._8.  _E_r_r_o_r _m_e_s_s_a_g_e _s_p_e_c_i_f_i_c_a_t_i_o_n
  3911.  
  3912.      This section specifies the  format  for  the  KRB_ERROR
  3913. message.  The fields included in the message are intended to
  3914. return as much information as possible about an  error.   It
  3915. is  not  expected  that  all the information required by the
  3916. fields will be available for all types of  errors.   If  the
  3917. appropriate information is not available when the message is
  3918. composed, the corresponding field will be left  out  of  the
  3919. message.
  3920.  
  3921.      Note that since the KRB_ERROR message is not  protected
  3922. by  any  encryption, it is quite possible for an intruder to
  3923. synthesize or modify such a message.   In  particular,  this
  3924. means that the client should not use any fields in this mes-
  3925. sage for security-critical purposes, such as setting a  sys-
  3926. tem  clock or generating a fresh authenticator.  The message
  3927. can be useful, however, for advising a user  on  the  reason
  3928. for some failure.
  3929.  
  3930. _5._8._1.  _K_R_B__E_R_R_O_R _d_e_f_i_n_i_t_i_o_n
  3931.  
  3932.      The KRB_ERROR message consists of the following fields:
  3933.  
  3934. KRB-ERROR ::=   [APPLICATION 30] SEQUENCE {
  3935.                 pvno[0]                       INTEGER,
  3936.                 msg-type[1]                   INTEGER,
  3937.                 ctime[2]                      KerberosTime OPTIONAL,
  3938.                 cusec[3]                      INTEGER OPTIONAL,
  3939. __________________________
  3940. [29] If supported by the encryption method in  use,  an
  3941. initialization  vector  may be passed to the encryption
  3942. procedure, in order to achieve proper cipher  chaining.
  3943. The  initialization  vector  might  come  from the last
  3944. block of the ciphertext from the previous KRB_PRIV mes-
  3945. sage, but it is the application's choice whether or not
  3946. to use such an initialization vector.  If left out, the
  3947. default  initialization vector for the encryption algo-
  3948. rithm will be used.
  3949.  
  3950. Section 5.8.1.             - 60 -   Expires 28 February 1993
  3951.  
  3952.  
  3953.  
  3954.  
  3955.  
  3956.  
  3957.                   Version 5 - Revision 5.1
  3958.  
  3959.  
  3960.                 stime[4]                      KerberosTime,
  3961.                 susec[5]                      INTEGER,
  3962.                 error-code[6]                 INTEGER,
  3963.                 crealm[7]                     Realm OPTIONAL,
  3964.                 cname[8]                      PrincipalName OPTIONAL,
  3965.                 realm[9]                      Realm, -- Correct realm
  3966.                 sname[10]                     PrincipalName, -- Correct name
  3967.                 e-text[11]                    GeneralString OPTIONAL,
  3968.                 e-data[12]                    OCTET STRING OPTIONAL
  3969. }
  3970.  
  3971.  
  3972.  
  3973. pvno and msg-type
  3974.           These fields are described above in section 5.4.1.
  3975.           msg-type is KRB_ERROR.
  3976.  
  3977.  
  3978. ctime     This field is described above in section 5.4.1.
  3979.  
  3980.  
  3981.  
  3982. cusec     This field is described above in section 5.5.2.
  3983.  
  3984.  
  3985. stime     This  field  contains  the  current  time  on  the
  3986.           server.  It is of type KerberosTime.
  3987.  
  3988.  
  3989. susec     This field contains the microsecond  part  of  the
  3990.           server's  timestamp.   Its  value ranges from 0 to
  3991.           999.  It appears along with stime. The two  fields
  3992.           are  used  in  conjunction to specify a reasonably
  3993.           accurate timestamp.
  3994.  
  3995.  
  3996. error-codeThis field contains the  error  code  returned  by
  3997.           Kerberos  or  the server when a request fails.  To
  3998.           interpret the value of this field see the list  of
  3999.           error  codes  in  section  8.  Implementations are
  4000.           encouraged to provide for national  language  sup-
  4001.           port in the display of error messages.
  4002.  
  4003.  
  4004. crealm, cname, srealm and sname
  4005.           These fields are described above in section 5.3.1.
  4006.  
  4007.  
  4008. e-text    This  field  contains  additional  text  to   help
  4009.           explain  the error code associated with the failed
  4010.           request (for example, it might include a principal
  4011.           name which was unknown).
  4012.  
  4013.  
  4014.  
  4015.  
  4016. Section 5.8.1.             - 61 -   Expires 28 February 1993
  4017.  
  4018.  
  4019.  
  4020.  
  4021.  
  4022.  
  4023.                   Version 5 - Revision 5.1
  4024.  
  4025.  
  4026. e-data    This field  contains  additional  data  about  the
  4027.           error  for  use  by  the  application  to  help it
  4028.           recover from or handle the error.  If  the  error-
  4029.           code  is  KRB_AP_ERR_METHOD, then the e-data field
  4030.           will  contain  an  encoding   of   the   following
  4031.           sequence:
  4032.  
  4033.        METHOD-DATA ::=   SEQUENCE {
  4034.                          method-type[0]   INTEGER,
  4035.                          method-data[1]   OCTET STRING OPTIONAL
  4036.        }
  4037.  
  4038.           method-type will indicate the  required  alternate
  4039.           method;  method-data  will  contain  any  required
  4040.           additional information.
  4041.  
  4042. _6.  _E_n_c_r_y_p_t_i_o_n _a_n_d _C_h_e_c_k_s_u_m _S_p_e_c_i_f_i_c_a_t_i_o_n_s
  4043.  
  4044. The  Kerberos  protocols  described  in  this  document  are
  4045. designed  to  use  stream  encryption  ciphers, which can be
  4046. simulated using commonly available block encryption ciphers,
  4047. such  as  the  Data Encryption Standard [10], in conjunction
  4048. with block chaining and checksum methods  [11].   Encryption
  4049. is used to prove the identities of the network entities par-
  4050. ticipating  in  message  exchanges.   The  Key  Distribution
  4051. Center   for   each  realm  is  trusted  by  all  principals
  4052. registered in that realm to store a  secret  key  in  confi-
  4053. dence.   Proof  of  knowledge  of this secret key is used to
  4054. verify the authenticity of a principal.
  4055.  
  4056.      The KDC uses the principal's  secret  key  (in  the  AS
  4057. exchange)  or  a shared session key (in the TGS exchange) to
  4058. encrypt responses to ticket requests; the ability to  obtain
  4059. the  secret  key or session key implies the knowledge of the
  4060. appropriate keys and the identity of the KDC.   The  ability
  4061. of  a  principal  to  decrypt the KDC response and present a
  4062. Ticket and a properly formed Authenticator  (generated  with
  4063. the session key from the KDC response) to a service verifies
  4064. the identity of the principal; likewise the ability  of  the
  4065. service to extract the session key from the Ticket and prove
  4066. its knowledge thereof in a response verifies the identity of
  4067. the service.
  4068.  
  4069.      The  Kerberos  protocols  generally  assume  that   the
  4070. encryption  used  is  secure from cryptanalysis; however, in
  4071. some cases, the order of fields in the encrypted portions of
  4072. messages  are  arranged  to  minimize  the effects of poorly
  4073. chosen keys.  It is still important to choose good keys.  If
  4074. keys  are derived from user-typed passwords, those passwords
  4075. need to be well chosen to make brute force attacks more dif-
  4076. ficult.   Poorly  chosen  keys  still  make easy targets for
  4077. intruders.
  4078.  
  4079.      The  following  sections  specify  the  encryption  and
  4080.  
  4081.  
  4082. Section 6.                 - 62 -   Expires 28 February 1993
  4083.  
  4084.  
  4085.  
  4086.  
  4087.  
  4088.  
  4089.                   Version 5 - Revision 5.1
  4090.  
  4091.  
  4092. checksum  mechanisms  currently  defined  for Kerberos.  The
  4093. encodings, chaining, and padding requirements for  each  are
  4094. described.  For encryption methods, it is often desirable to
  4095. place random information (often referred to as a _c_o_n_f_o_u_n_d_e_r)
  4096. at  the  start  of the message.  The requirements for a con-
  4097. founder are specified with each encryption mechanism.
  4098.  
  4099.      Some encryption systems use a block-chaining method  to
  4100. improve  the the security characteristics of the ciphertext.
  4101. However, these  chaining  methods  often  don't  provide  an
  4102. integrity  check upon decryption.  Such systems (such as DES
  4103. in CBC mode) must be augmented with a checksum of the plain-
  4104. text  which can be verified at decryption and used to detect
  4105. any tampering or damage.  Such checksums should be  good  at
  4106. detecting  burst  errors  in  the  input.   If any damage is
  4107. detected, the decryption routine is expected  to  return  an
  4108. error  indicating  the  failure of an integrity check.  Each
  4109. encryption  type  is  expected  to  provide  and  verify  an
  4110. appropriate  checksum.  The specification of each encryption
  4111. method sets out its checksum requirements.
  4112.  
  4113.      Finally, where a key is to be  derived  from  a  user's
  4114. password,  an algorithm for converting the password to a key
  4115. of the appropriate type is included.  It  is  desirable  for
  4116. the  string  to key function to be one-way, and for the map-
  4117. ping to be different in different realms.  This is important
  4118. because users who are registered in more than one realm will
  4119. often use the same password in each,  and  it  is  desirable
  4120. that  an  attacker  compromising  the Kerberos server in one
  4121. realm not obtain or derive the user's key in another.
  4122.  
  4123.      For an discussion of the integrity  characteristics  of
  4124. the candidate encryption and checksum methods considered for
  4125. Kerberos, the the reader is referred to [12].
  4126.  
  4127. _6._1.  _E_n_c_r_y_p_t_i_o_n _S_p_e_c_i_f_i_c_a_t_i_o_n_s
  4128.  
  4129.      The following ASN.1 definition describes all  encrypted
  4130. messages.   The  enc-part  field  which appears in the unen-
  4131. crypted part of messages in section 5 is a sequence consist-
  4132. ing  of  an encryption type, an optional key version number,
  4133. and the ciphertext.
  4134.  
  4135.  
  4136. EncryptedData ::=   SEQUENCE {
  4137.                     etype[0]     INTEGER, -- EncryptionType
  4138.                     kvno[1]      INTEGER OPTIONAL,
  4139.                     cipher[2]    OCTET STRING -- ciphertext
  4140. }
  4141.  
  4142.  
  4143. etype     This field identifies which  encryption  algorithm
  4144.           was used to encipher the cipher.  Detailed specif-
  4145.           ications  for  selected  encryption  types  appear
  4146.  
  4147.  
  4148. Section 6.1.               - 63 -   Expires 28 February 1993
  4149.  
  4150.  
  4151.  
  4152.  
  4153.  
  4154.  
  4155.                   Version 5 - Revision 5.1
  4156.  
  4157.  
  4158.           later in this section.
  4159.  
  4160.  
  4161. kvno      This field contains the version number of the  key
  4162.           under which data is encrypted.  It is only present
  4163.           in messages encrypted  under  long  lasting  keys,
  4164.           such as principals' secret keys.
  4165.  
  4166.  
  4167. cipher    This field contains the enciphered  text,  encoded
  4168.           as an OCTET STRING.
  4169.  
  4170.  
  4171.      The cipher field is generated by applying the specified
  4172. encryption  algorithm  to  data  composed of the message and
  4173. algorithm-specific inputs.   Encryption  mechanisms  defined
  4174. for  use  with  Kerberos  must  take  sufficient measures to
  4175. guarantee the integrity of the plaintext, and  we  recommend
  4176. they  also take measures to protect against precomputed dic-
  4177. tionary attacks.  If the encryption algorithm is not  itself
  4178. capable  of  doing so, the protections can often be enhanced
  4179. by adding a checksum and a confounder.
  4180.  
  4181.      The suggested format  for  the  data  to  be  encrypted
  4182. includes  a  confounder,  a checksum, the encoded plaintext,
  4183. and any necessary padding.  The msg-seq field  contains  the
  4184. part of the protocol message described in section 5 which is
  4185. to be encrypted.  The confounder, checksum, and padding  are
  4186. all untagged and untyped, and their length is exactly suffi-
  4187. cient to hold the appropriate item.  The type and length  is
  4188. implicit  and  specified  by  the particular encryption type
  4189. being used (etype).  The format for the data to be encrypted
  4190. is described in the following diagram:
  4191.  
  4192.       +-----------+----------+-------------+-----+
  4193.       |confounder |   check  |   msg-seq   | pad |
  4194.       +-----------+----------+-------------+-----+
  4195.  
  4196. The format cannot be described in ASN.1, but for  those  who
  4197. prefer an ASN.1-_l_i_k_e notation:
  4198.  
  4199.  
  4200. __________________________
  4201. [31] In  the  above   specification,   UNTAGGED   OCTET
  4202. STRING(length) is the notation for an octet string with
  4203. its tag and length removed.  It is not  a  valid  ASN.1
  4204. type.  The tag bits and length must be removed from the
  4205. confounder since the purpose of the  confounder  is  so
  4206. that  the  message starts with random data, but the tag
  4207. and its length are fixed.  For other fields, the length
  4208. and  tag  would  be redundant if they were included be-
  4209. cause they are specified by the encryption type.
  4210.  
  4211.  
  4212.  
  4213. Section 6.1.               - 64 -   Expires 28 February 1993
  4214.  
  4215.  
  4216.  
  4217.  
  4218.  
  4219.  
  4220.                   Version 5 - Revision 5.1
  4221.  
  4222.  
  4223.  
  4224. CipherText ::=   ENCRYPTED       SEQUENCE {
  4225.                  confounder[0]   UNTAGGED[31] OCTET STRING(conf_length) OPTIONAL,
  4226.                  check[1]        UNTAGGED OCTET STRING(checksum_length) OPTIONAL,
  4227.                  msg-seq[2]      MsgSequence,
  4228.                  pad             UNTAGGED OCTET STRING(pad_length) OPTIONAL
  4229. }
  4230.  
  4231.  
  4232.      One generates a random confounder  of  the  appropriate
  4233. length,  placing  it in confounder; zeroes out check; calcu-
  4234. lates the appropriate checksum over confounder,  check,  and
  4235. msg-seq,  placing  the  result  in check; adds the necessary
  4236. padding; then encrypts using the specified  encryption  type
  4237. and the appropriate key.
  4238.  
  4239.      Unless otherwise specified, a definition of an  encryp-
  4240. tion  algorithm  that specifies a checksum, a length for the
  4241. confounder field, or an octet boundary for padding uses this
  4242. ciphertext format[32].  Those fields which are not specified
  4243. will be omitted.
  4244.  
  4245.      In the interest of allowing all implementations using a
  4246. particular  encryption  type  to communicate with all others
  4247. using that type, the specification  of  an  encryption  type
  4248. defines  any  checksum that is needed as part of the encryp-
  4249. tion process.  If an alternative checksum is to be  used,  a
  4250. new encryption type must be defined.
  4251.  
  4252.      Some  cryptosystems  require   additional   information
  4253. beyond  the  key and the data to be encrypted.  For example,
  4254. DES, when used in cipher-block-chaining  mode,  requires  an
  4255. initialization  vector.   If  required,  the description for
  4256. each encryption type must specify the source of  such  addi-
  4257. tional information.
  4258.  
  4259. _6._2.  _E_n_c_r_y_p_t_i_o_n _K_e_y_s
  4260.  
  4261.      The sequence below shows the encoding of an  encryption
  4262. key:
  4263.  
  4264.        EncryptionKey ::=   SEQUENCE {
  4265. __________________________
  4266. [32] The ordering of the fields in  the  CipherText  is
  4267. important.  Additionally, messages encoded in this for-
  4268. mat must include a length as part of the msg-seq field.
  4269. This  allows  the  recipient to verify that the message
  4270. has not been truncated.  Without a length, an  attacker
  4271. could  use a chosen plaintext attack to generate a mes-
  4272. sage which could be truncated, while leaving the check-
  4273. sum intact.  Note that if the msg-seq is an encoding of
  4274. an ASN.1 SEQUENCE or OCTET STRING, then the  length  is
  4275. part of that encoding.
  4276.  
  4277. Section 6.2.               - 65 -   Expires 28 February 1993
  4278.  
  4279.  
  4280.  
  4281.  
  4282.  
  4283.  
  4284.                   Version 5 - Revision 5.1
  4285.  
  4286.  
  4287.                            keytype[0]    INTEGER,
  4288.                            keyvalue[1]   OCTET STRING
  4289.        }
  4290.  
  4291.  
  4292. keytype   This field specifies the type  of  encryption  key
  4293.           that  follows  in  the  keyvalue  field.   It will
  4294.           almost always correspond to the  encryption  algo-
  4295.           rithm  used  to generate the EncryptedData, though
  4296.           more than one algorithm may use the same  type  of
  4297.           key (the mapping is many to one).  This might hap-
  4298.           pen, for example, if the encryption algorithm uses
  4299.           an  alternate  checksum algorithm for an integrity
  4300.           check, or a different chaining mechanism.
  4301.  
  4302.  
  4303. keyvalue  This field contains the key itself, encoded as  an
  4304.           octet string.
  4305.  
  4306.      All negative values for the  encryption  key  type  are
  4307. reserved   for  local  use.   All  non-negative  values  are
  4308. reserved for officially assigned type fields and interpreta-
  4309. tions.
  4310.  
  4311. _6._3.  _E_n_c_r_y_p_t_i_o_n _S_y_s_t_e_m_s
  4312.  
  4313. _6._3._1.  _T_h_e _N_U_L_L _E_n_c_r_y_p_t_i_o_n _S_y_s_t_e_m (_n_u_l_l)
  4314.  
  4315.      If no encryption is in use, the  encryption  system  is
  4316. said  to be the NULL encryption system.  In the NULL encryp-
  4317. tion system there is no  checksum,  confounder  or  padding.
  4318. The  ciphertext  is  simply  the plaintext.  The NULL Key is
  4319. used by the null encryption system and  is  zero  octets  in
  4320. length, with keytype zero (0).
  4321.  
  4322. _6._3._2.  _D_E_S _i_n _C_B_C _m_o_d_e _w_i_t_h _a _C_R_C-_3_2 _c_h_e_c_k_s_u_m (_d_e_s-_c_b_c-_c_r_c)
  4323.  
  4324.      The des-cbc-crc encryption  mode  encrypts  information
  4325. under  the  Data  Encryption Standard  [10] using the cipher
  4326. block chaining mode [11].  A CRC-32 checksum  (described  in
  4327. ISO  3309  [13])  is  applied  to the confounder and message
  4328. sequence (msg-seq) and  placed  in  the  cksum  field.   DES
  4329. blocks  are  8 bytes.  As a result, the data to be encrypted
  4330. (the concatenation of  confounder,  checksum,  and  message)
  4331. must be padded to an 8 byte boundary before encryption.  The
  4332. details of the encryption of  this  data  are  identical  to
  4333. those for the des-cbc-md5 encryption mode.
  4334.  
  4335.      Note that, since the CRC-32 checksum is not  collision-
  4336. proof,   an  attacker  could  use  a  probabilistic  chosen-
  4337. plaintext attack to generate a valid message even if a  con-
  4338. founder is used  [12].  The use of collision-proof checksums
  4339. is recommended for environments where such attacks represent
  4340. a significant threat.  The use of the CRC-32 as the checksum
  4341.  
  4342.  
  4343. Section 6.3.2.             - 66 -   Expires 28 February 1993
  4344.  
  4345.  
  4346.  
  4347.  
  4348.  
  4349.  
  4350.                   Version 5 - Revision 5.1
  4351.  
  4352.  
  4353. for ticket or authenticator is  no  longer  mandated  as  an
  4354. interoperability requirement for Kerberos Version 5 Specifi-
  4355. cation 1 (See section 9.1 for specific details).
  4356.  
  4357.  
  4358. _6._3._3.  _D_E_S _i_n _C_B_C _m_o_d_e _w_i_t_h _a_n _M_D_4 _c_h_e_c_k_s_u_m (_d_e_s-_c_b_c-_m_d_4)
  4359.  
  4360.      The des-cbc-md4 encryption  mode  encrypts  information
  4361. under  the  Data  Encryption Standard  [10] using the cipher
  4362. block chaining mode [11].  An  MD4  checksum  (described  in
  4363. [14])  is  applied  to  the  confounder and message sequence
  4364. (msg-seq) and placed in the cksum field.  DES blocks  are  8
  4365. bytes.   As a result, the data to be encrypted (the concate-
  4366. nation of confounder, checksum, and message) must be  padded
  4367. to an 8 byte boundary before encryption.  The details of the
  4368. encryption of this data are identical to those for the  des-
  4369. cbc-md5 encryption mode.
  4370.  
  4371.  
  4372. _6._3._4.  _D_E_S _i_n _C_B_C _m_o_d_e _w_i_t_h _a_n _M_D_5 _c_h_e_c_k_s_u_m (_d_e_s-_c_b_c-_m_d_5)
  4373.  
  4374.      The des-cbc-md5 encryption  mode  encrypts  information
  4375. under  the  Data  Encryption Standard  [10] using the cipher
  4376. block chaining mode [11].  An MD5  checksum   (described  in
  4377. [15].)  is  applied  to  the confounder and message sequence
  4378. (msg-seq) and placed in the cksum field.  DES blocks  are  8
  4379. bytes.   As a result, the data to be encrypted (the concate-
  4380. nation of confounder, checksum, and message) must be  padded
  4381. to an 8 byte boundary before encryption.
  4382.  
  4383.      Plaintext and DES ciphtertext are  encoded  as  8-octet
  4384. blocks  which are concatenated to make the 64-bit inputs for
  4385. the DES algorithms.  The first octet  supplies  the  8  most
  4386. significant  bits  (with  the  octet's MSbit used as the DES
  4387. input block's MSbit, etc.), the  second  octet  the  next  8
  4388. bits,  ..., and the eighth octet supplies the 8 least signi-
  4389. ficant bits.
  4390.  
  4391.      Encryption  under  DES  using  cipher  block   chaining
  4392. requires  an  additional input in the form of an initializa-
  4393. tion vector.  Unless otherwise  specified,  zero  should  be
  4394. used  as  the  initialization  vector.  Kerberos' use of DES
  4395. requires an 8-octet confounder.
  4396.  
  4397.      The DES specifications identify some "weak" and  "semi-
  4398. weak" keys; those keys shall not be used for encrypting mes-
  4399. sages for use in Kerberos.  Additionally, because of the way
  4400. that  keys are derived for the encryption of checksums, keys
  4401. shall not be used that yield "weak" or "semi-weak" keys when
  4402. eXclusive-ORed with the constant F0F0F0F0F0F0F0F0.
  4403.  
  4404.      A DES key is 8 octets of data, with  keytype  one  (1).
  4405. This  consists of 56 bits of key, and 8 parity bits (one per
  4406. octet).  The key is encoded as a series of 8 octets  written
  4407.  
  4408.  
  4409. Section 6.3.4.             - 67 -   Expires 28 February 1993
  4410.  
  4411.  
  4412.  
  4413.  
  4414.  
  4415.  
  4416.                   Version 5 - Revision 5.1
  4417.  
  4418.  
  4419. in  MSB-first  order.   The  bits  within  the  key are also
  4420. encoded in MSB order.  For example, if the encryption key is
  4421. (B1,B2,...,B7,P1,B8,...,B14,P2,B15,...,B49,P7,B50,...,B56,P8)
  4422. where B1,B2,...,B56 are the  key  bits  in  MSB  order,  and
  4423. P1,P2,...,P8 are the parity bits, the first octet of the key
  4424. would be B1,B2,...,B7,P1 (with B1 as the MSbit).   [See  the
  4425. FIPS 81 introduction for reference.]
  4426.  
  4427.      To generate a DES key from a  text  string  (password),
  4428. the  text  string normally must have the realm and each com-
  4429. ponent of the principal's  name  appended[33],  then  padded
  4430. with ASCII nulls to an 8 byte boundary.  This string is then
  4431. fan-folded and eXclusive-ORed with itself to form an 8  byte
  4432. DES key.  The parity is corrected on the key, and it is used
  4433. to generate a DES CBC checksum on the initial  string  (with
  4434. the  realm and name appended).  Next, parity is corrected on
  4435. the CBC checksum.  If the result matches a "weak" or  "semi-
  4436. weak"  key  as  described  in  the  DES specification, it is
  4437. eXclusive-ORed with the constant 00000000000000F0.  Finally,
  4438. the result is returned as the key.  Pseudocode follows:
  4439.  
  4440.      string_to_key(string,realm,name) {
  4441.           odd = 1;
  4442.           s = string + realm;
  4443.           for(each component in name) {
  4444.                s = s + component;
  4445.           }
  4446.           tempkey = NULL;
  4447.           pad(s); /* with nulls to 8 byte boundary */
  4448.           for(8byteblock in s) {
  4449.                if(odd == 0)  {
  4450.                    odd = 1;
  4451.                    reverse(8byteblock)
  4452.                }
  4453.                else odd = 0;
  4454.                tempkey = tempkey XOR 8byteblock;
  4455.           }
  4456.           fixparity(tempkey);
  4457.           key = DES-CBC-check(s,tempkey);
  4458.           fixparity(key);
  4459.           if(is_weak_key_key(key))
  4460.                key = key XOR 0xF0;
  4461.           return(key);
  4462.      }
  4463.  
  4464. _6._4.  _C_h_e_c_k_s_u_m_s
  4465.  
  4466.      The following is the ASN.1 definition used for a check-
  4467. sum:
  4468. __________________________
  4469. [33] In some cases, it may be necessary to use  a  dif-
  4470. ferent  "mix-in"  string for compatibility reasons; see
  4471. the discussion of padata in section 5.4.2.
  4472.  
  4473. Section 6.4.               - 68 -   Expires 28 February 1993
  4474.  
  4475.  
  4476.  
  4477.  
  4478.  
  4479.  
  4480.                   Version 5 - Revision 5.1
  4481.  
  4482.  
  4483.          Checksum ::=   SEQUENCE {
  4484.                         cksumtype[0]   INTEGER,
  4485.                         checksum[1]    OCTET STRING
  4486.          }
  4487.  
  4488.  
  4489. cksumtype This field indicates the algorithm  used  to  gen-
  4490.           erate the accompanying checksum.
  4491.  
  4492. checksum  This field contains the checksum  itself,  encoded
  4493.           as an octet string.
  4494.  
  4495.      Detailed  specification  of  selected  checksum   types
  4496. appear  later  in  this  section.   Negative  values for the
  4497. checksum type are reserved for local use.  All  non-negative
  4498. values  are reserved for officially assigned type fields and
  4499. interpretations.
  4500.  
  4501.      Checksums used by Kerberos can  be  classified  by  two
  4502. properties:   whether  they are collision-proof, and whether
  4503. they are keyed.  It is infeasible  to  find  two  plaintexts
  4504. which generate the same checksum value for a collision-proof
  4505. checksum.  A key is required to perturb  or  initialize  the
  4506. algorithm  in  a  keyed checksum.  To prevent message-stream
  4507. modification by an active attacker, unkeyed checksums should
  4508. only  be  used  when the checksum and message will be subse-
  4509. quently encrypted (e.g. the checksums defined as part of the
  4510. encryption  algorithms  covered  earlier  in  this section).
  4511. Collision-proof checksums can be made tamper-proof  as  well
  4512. if  the  checksum  value  is encrypted before inclusion in a
  4513. message.  In such cases, the composition of the checksum and
  4514. the  encryption  algorithm  must  be  considered  a separate
  4515. checksum algorithm (e.g. RSA-MD5 encrypted using  DES  is  a
  4516. new checksum algorithm of type RSA-MD5-DES).  For most keyed
  4517. checksums, as well as for the encrypted forms of  collision-
  4518. proof  checksums,  Kerberos prepends a confounder before the
  4519. checksum is calculated.
  4520.  
  4521. _6._4._1.  _T_h_e _C_R_C-_3_2 _C_h_e_c_k_s_u_m (_c_r_c_3_2)
  4522.  
  4523.      The CRC-32 checksum calculates a checksum  based  on  a
  4524. cyclic  redundancy check as described in ISO 3309 [13].  The
  4525. resulting checksum is four (4) octets in length.  The CRC-32
  4526. is  neither  keyed  nor  collision-proof.   The  use of this
  4527. checksum is not recommended.  An  attacker  using  a  proba-
  4528. bilistic  chosen-plaintext attack as described in [12] might
  4529. be able to generate an alternative  message  that  satisfies
  4530. the  checksum.   The  use  of  collision-proof  checksums is
  4531. recommended for environments where such attacks represent  a
  4532. significant threat.
  4533.  
  4534. _6._4._2.  _T_h_e _R_S_A _M_D_4 _C_h_e_c_k_s_u_m (_r_s_a-_m_d_4)
  4535.  
  4536.      The RSA-MD4 checksum calculates a  checksum  using  the
  4537.  
  4538.  
  4539. Section 6.4.2.             - 69 -   Expires 28 February 1993
  4540.  
  4541.  
  4542.  
  4543.  
  4544.  
  4545.  
  4546.                   Version 5 - Revision 5.1
  4547.  
  4548.  
  4549. RSA  MD4  algorithm  [14].   The algorithm takes as input an
  4550. input message of arbitrary length and produces as  output  a
  4551. 128-bit  (16  octet)  checksum.   RSA-MD4  is believed to be
  4552. collision-proof.
  4553.  
  4554. _6._4._3.  _R_S_A _M_D_4 _C_r_y_p_t_o_g_r_a_p_h_i_c _C_h_e_c_k_s_u_m _U_s_i_n_g  _D_E_S  (_r_s_a-_m_d_4-
  4555. _d_e_s)
  4556.  
  4557.      The RSA-MD4-DES checksum calculates a keyed  collision-
  4558. proof  checksum  by  prepending an 8 octet confounder before
  4559. the text, applying  the  RSA  MD4  checksum  algorithm,  and
  4560. encrypting  the  confounder  and  the  checksum using DES in
  4561. cipher-block-chaining (CBC) mode using a variant of the key,
  4562. where  the  variant  is  computed by eXclusive-ORing the key
  4563. with the constant F0F0F0F0F0F0F0F0[34].  The  initialization
  4564. vector  should be zero.  The resulting checksum is 24 octets
  4565. long (8 octets of which are redundant).   This  checksum  is
  4566. tamper-proof and believed to be collision-proof.
  4567.  
  4568.      The DES specifications identify some "weak keys"; those
  4569. keys  shall not be used for generating RSA-MD4 checksums for
  4570. use in Kerberos.
  4571.  
  4572.      The format for the checksum is described in the follow-
  4573. ing diagram:
  4574.  
  4575. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  4576. |  des-cbc(confounder   +   rsa-md4(confounder+msg),key=var(key),iv=0)  |
  4577. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  4578.  
  4579. The format cannot be described in ASN.1, but for  those  who
  4580. prefer an ASN.1-_l_i_k_e notation:
  4581.  
  4582. rsa-md4-des-checksum ::=   ENCRYPTED       UNTAGGED SEQUENCE {
  4583.                            confounder[0]   UNTAGGED OCTET STRING(8),
  4584.                            check[1]        UNTAGGED OCTET STRING(16)
  4585. }
  4586.  
  4587.  
  4588.  
  4589.  
  4590.  
  4591. __________________________
  4592. [34] A variant of the key is used to limit the use of a
  4593. key  to a particular function, separating the functions
  4594. of generating a checksum  from  other  encryption  per-
  4595. formed   using   the   session   key.    The   constant
  4596. F0F0F0F0F0F0F0F0 was chosen because  it  maintains  key
  4597. parity.  The properties of DES precluded the use of the
  4598. complement.  The same constant is used for similar pur-
  4599. pose  in  the  Message  Integrity  Check in the Privacy
  4600. Enhanced Mail standard.
  4601.  
  4602.  
  4603.  
  4604. Section 6.4.3.             - 70 -   Expires 28 February 1993
  4605.  
  4606.  
  4607.  
  4608.  
  4609.  
  4610.  
  4611.                   Version 5 - Revision 5.1
  4612.  
  4613.  
  4614. _6._4._4.  _T_h_e _R_S_A _M_D_5 _C_h_e_c_k_s_u_m (_r_s_a-_m_d_5)
  4615.  
  4616.      The RSA-MD5 checksum calculates a  checksum  using  the
  4617. RSA  MD5  algorithm  [15]..  The algorithm takes as input an
  4618. input message of arbitrary length and produces as  output  a
  4619. 128-bit  (16  octet)  checksum.   RSA-MD5  is believed to be
  4620. collision-proof.
  4621.  
  4622. _6._4._5.  _R_S_A _M_D_5 _C_r_y_p_t_o_g_r_a_p_h_i_c _C_h_e_c_k_s_u_m _U_s_i_n_g  _D_E_S  (_r_s_a-_m_d_5-
  4623. _d_e_s)
  4624.  
  4625.      The RSA-MD5-DES checksum calculates a keyed  collision-
  4626. proof  checksum  by  prepending an 8 octet confounder before
  4627. the text, applying  the  RSA  MD5  checksum  algorithm,  and
  4628. encrypting  the  confounder  and  the  checksum using DES in
  4629. cipher-block-chaining (CBC) mode using a variant of the key,
  4630. where  the  variant  is  computed by eXclusive-ORing the key
  4631. with the constant F0F0F0F0F0F0F0F0.  The initialization vec-
  4632. tor  should  be  zero.   The resulting checksum is 24 octets
  4633. long (8 octets of which are redundant).   This  checksum  is
  4634. tamper-proof and believed to be collision-proof.
  4635.  
  4636.      The DES specifications identify some "weak keys"; those
  4637. keys  shall not be used for encrypting RSA-MD5 checksums for
  4638. use in Kerberos.
  4639.  
  4640.      The format for the checksum is described in the follow-
  4641. ing diagram:
  4642.  
  4643. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  4644. |  des-cbc(confounder   +   rsa-md5(confounder+msg),key=var(key),iv=0)  |
  4645. +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  4646.  
  4647. The format cannot be described in ASN.1, but for  those  who
  4648. prefer an ASN.1-_l_i_k_e notation:
  4649.  
  4650. rsa-md5-des-checksum ::=   ENCRYPTED       UNTAGGED SEQUENCE {
  4651.                            confounder[0]   UNTAGGED OCTET STRING(8),
  4652.                            check[1]        UNTAGGED OCTET STRING(16)
  4653. }
  4654.  
  4655.  
  4656. _6._4._6.  _D_E_S _c_i_p_h_e_r-_b_l_o_c_k _c_h_a_i_n_e_d _c_h_e_c_k_s_u_m (_d_e_s-_m_a_c)
  4657.  
  4658.      The DES-MAC checksum is computed  by  prepending  an  8
  4659. octet confounder to the plaintext, performing a DES CBC-mode
  4660. encryption on the result using the key and an initialization
  4661. vector  of  zero,  taking  the last block of the ciphertext,
  4662. prepending the same confounder and encrypting the pair using
  4663. DES in cipher-block-chaining (CBC) mode using a a variant of
  4664. the key, where the variant is  computed  by  eXclusive-ORing
  4665. the key with the constant F0F0F0F0F0F0F0F0.  The initializa-
  4666. tion vector should be zero.  The resulting checksum  is  128
  4667. bits (16 octets) long, 64 bits of which are redundant.  This
  4668.  
  4669.  
  4670. Section 6.4.6.             - 71 -   Expires 28 February 1993
  4671.  
  4672.  
  4673.  
  4674.  
  4675.  
  4676.  
  4677.                   Version 5 - Revision 5.1
  4678.  
  4679.  
  4680. checksum is tamper-proof and collision-proof.
  4681.  
  4682.      The format for the checksum is described in the follow-
  4683. ing diagram:
  4684.  
  4685. +--+--+--+--+--+--+--+--+-----+-----+-----+-----+-----+-----+-----+-----+
  4686. |   des-cbc(confounder  + des-mac(conf+msg,iv=0,key),key=var(key),iv=0) |
  4687. +--+--+--+--+--+--+--+--+-----+-----+-----+-----+-----+-----+-----+-----+
  4688.  
  4689. The format cannot be described in ASN.1, but for  those  who
  4690. prefer an ASN.1-_l_i_k_e notation:
  4691.  
  4692. des-mac-checksum ::=   ENCRYPTED       UNTAGGED SEQUENCE {
  4693.                        confounder[0]   UNTAGGED OCTET STRING(8),
  4694.                        check[1]        UNTAGGED OCTET STRING(8)
  4695. }
  4696.  
  4697.  
  4698.      The DES specifications identify some "weak" and  "semi-
  4699. weak"  keys;  those  keys  shall  not be used for generating
  4700. DES-MAC checksums for use in Kerberos, nor shall  a  key  be
  4701. used whose veriant is "weak" or "semi-weak".
  4702.  
  4703. _6._4._7.  _R_S_A _M_D_4 _C_r_y_p_t_o_g_r_a_p_h_i_c _C_h_e_c_k_s_u_m _U_s_i_n_g _D_E_S _a_l_t_e_r_n_a_t_i_v_e
  4704. (_r_s_a-_m_d_4-_d_e_s-_k)
  4705.  
  4706.      The   RSA-MD4-DES-K   checksum   calculates   a   keyed
  4707. collision-proof  checksum  by  applying the RSA MD4 checksum
  4708. algorithm and encrypting the results using  DES  in  cipher-
  4709. block-chaining  (CBC)  mode  using a DES key as both key and
  4710. initialization vector.  The resulting checksum is 16  octets
  4711. long.   This  checksum  is  tamper-proof  and believed to be
  4712. collision-proof.  Note that this checksum type  is  the  old
  4713. method  for  encoding  the RSA-MD4-DES checksum and it is no
  4714. longer recommended.
  4715.  
  4716. _6._4._8.  _D_E_S _c_i_p_h_e_r-_b_l_o_c_k _c_h_a_i_n_e_d _c_h_e_c_k_s_u_m _a_l_t_e_r_n_a_t_i_v_e  (_d_e_s-
  4717. _m_a_c-_k)
  4718.  
  4719.      The DES-MAC-K checksum is computed by performing a  DES
  4720. CBC-mode  encryption  of  the  plaintext, and using the last
  4721. block of the ciphertext as the checksum value.  It is  keyed
  4722. with  an  encryption  key  and an initialization vector; any
  4723. uses which do not specify an additional initialization  vec-
  4724. tor  will use the key as both key and initialization vector.
  4725. The resulting checksum is 64 bits  (8  octets)  long.   This
  4726. checksum  is  tamper-proof  and  collision-proof.  Note that
  4727. this checksum type is the old method for encoding  the  DES-
  4728. MAC checksum and it is no longer recommended.
  4729.  
  4730.      The DES specifications identify some "weak keys"; those
  4731. keys  shall not be used for generating DES-MAC checksums for
  4732. use in Kerberos.
  4733.  
  4734.  
  4735.  
  4736. Section 6.4.8.             - 72 -   Expires 28 February 1993
  4737.  
  4738.  
  4739.  
  4740.  
  4741.  
  4742.  
  4743.                   Version 5 - Revision 5.1
  4744.  
  4745.  
  4746. _7.  _N_a_m_i_n_g _C_o_n_s_t_r_a_i_n_t_s
  4747.  
  4748.  
  4749. _7._1.  _R_e_a_l_m _N_a_m_e_s
  4750.  
  4751.      Although realm names are encoded as GeneralStrings  and
  4752. although a realm can technically select any name it chooses,
  4753. interoperability across realm boundaries requires  agreement
  4754. on  how realm names are to be assigned, and what information
  4755. they imply.
  4756.  
  4757.      To enforce these conventions, each realm  must  conform
  4758. to  the  conventions  itself,  and  it must require that any
  4759. realms with which inter-realm keys are shared  also  conform
  4760. to the conventions and require the same from its neighbors.
  4761.  
  4762.      There are presently four styles of realm names: domain,
  4763. X500, other, and reserved.  Examples of each style follow:
  4764.  
  4765.      domain:   host.subdomain.domain (example)
  4766.        X500:   C=US/O=OSF (example)
  4767.       other:   NAMETYPE:rest/of.name=without-restrictions (example)
  4768.    reserved:   reserved, but will not conflict with above
  4769.  
  4770.  
  4771. Domain names must look like domain names:  they  consist  of
  4772. components separated by periods (.) and they contain neither
  4773. colons (:) nor slashes (/).
  4774.  
  4775.      X.500 names contain an equal (=) and cannot  contain  a
  4776. colon (:) before the equal.  The realm names for X.500 names
  4777. will be string representations of the names with  components
  4778. separated by slashes.  Leading and trailing slashes will not
  4779. be included.
  4780.  
  4781.      Names that fall into the other category must begin with
  4782. a  prefix  that  contains no equal (=) or period (.) and the
  4783. prefix must be followed by a colon (:) and the rest  of  the
  4784. name.   All  prefixes  must  be  assigned before they may be
  4785. used.  Presently none are assigned.
  4786.  
  4787.      The reserved category includes  strings  which  do  not
  4788. fall  into  the  first  three categories.  All names in this
  4789. category are reserved.  It is unlikely that  names  will  be
  4790. assigned  to  this  category  unless  there is a very strong
  4791. argument for not using the "other" category.
  4792.  
  4793.      These rules guarantee that there will be  no  conflicts
  4794. between  the  various name styles.  The following additional
  4795. constraints apply to the assignment of realm  names  in  the
  4796. domain  and  X.500  categories:  the name of a realm for the
  4797. domain or X.500 formats must either be used by the organiza-
  4798. tion  owning  (to  whom  it was assigned) an Internet domain
  4799. name or X.500 name, or in the case that no  such  names  are
  4800.  
  4801.  
  4802. Section 7.1.               - 73 -   Expires 28 February 1993
  4803.  
  4804.  
  4805.  
  4806.  
  4807.  
  4808.  
  4809.                   Version 5 - Revision 5.1
  4810.  
  4811.  
  4812. registered,  authority  to  use  a realm name may be derived
  4813. from the authority of the  parent  realm.  For  example,  if
  4814. there  is  no domain name for E40.MIT.EDU, then the adminis-
  4815. trator of the MIT.EDU realm can authorize the creation of  a
  4816. realm with that name.
  4817.  
  4818.      This is acceptable because the  organization  to  which
  4819. the  parent  is  assigned  is  presumably  the  organization
  4820. authorized to assign names to its children in the X.500  and
  4821. domain  name systems as well.  If the parent assigns a realm
  4822. name without also registering it in the domain name or X.500
  4823. hierarchy,  it  is  the parent's responsibility to make sure
  4824. that there will not in the future exists a name identical to
  4825. the  realm  name  of  the child unless it is assigned to the
  4826. same entity as the realm name.
  4827.  
  4828.  
  4829. _7._2.  _P_r_i_n_c_i_p_a_l _N_a_m_e_s
  4830.  
  4831.      As was the case for realm names, conventions are needed
  4832. to ensure that all agree on what information is implied by a
  4833. principal name.  The name-type field that  is  part  of  the
  4834. principal  name indicates the kind of information implied by
  4835. the name.  The  name-type  should  be  treated  as  a  hint.
  4836. Ignoring  the  name type, no two names can be the same (i.e.
  4837. at least one of the components, or the realm, must  be  dif-
  4838. ferent).   This  constraint may be eliminated in the future.
  4839. The following name types are defined:
  4840.  
  4841.    name-type      value   meaning
  4842.    NT-UNKNOWN       0     Name type not known
  4843.    NT-PRINCIPAL     1     Just the name of the principal as in DCE, or for users
  4844.    NT-SRV-INST      2     Service and other unique instance (krbtgt)
  4845.    NT-SRV-HST       3     Service with host name as instance (telnet, rcommands)
  4846.    NT-SRV-XHST      4     Service with host as remaining components
  4847.    NT-UID           5     Unique ID
  4848.  
  4849.  
  4850. When a name implies no information other than its uniqueness
  4851. at a particular time the name type PRINCIPAL should be used.
  4852. The principal name type should be used  for  users,  and  it
  4853. might  also  be  used for a unique server.  If the name is a
  4854. unique machine generated ID that is guaranteed never  to  be
  4855. reassigned  then  the  name type of UID should be used (note
  4856. that it is generally a bad idea to  reassign  names  of  any
  4857. type  since  stale  entries  might  remain in access control
  4858. lists).
  4859.  
  4860.      If the first component of a name identifies  a  service
  4861. and  the  remaining  components  identify an instance of the
  4862. service in a server specified manner, then the name type  of
  4863. SRV-INST  should  be  used.  An example of this name type is
  4864. the Kerberos ticket-granting ticket which has a  first  com-
  4865. ponent  of  krbtgt  and  a  second component identifying the
  4866.  
  4867.  
  4868. Section 7.2.               - 74 -   Expires 28 February 1993
  4869.  
  4870.  
  4871.  
  4872.  
  4873.  
  4874.  
  4875.                   Version 5 - Revision 5.1
  4876.  
  4877.  
  4878. realm for which the ticket is valid.
  4879.  
  4880.      If instance is a single component following the service
  4881. name  and  the  instance  identifies  the  host on which the
  4882. server is running, then the  name  type  SRV-HST  should  be
  4883. used.   This  type  is  typically used for Internet services
  4884. such as telnet and the Berkeley R commands.  If the separate
  4885. components  of the host name appear as successive components
  4886. following the name of the service, then the name  type  SRV-
  4887. XHST  should  be  used.  This type might be used to identify
  4888. servers on hosts with X.500 names where the slash (/)  might
  4889. otherwise be ambiguous.
  4890.  
  4891.      A name type of UNKNOWN should be used when the form  of
  4892. the name is not known.  When comparing names, a name of type
  4893. UNKNOWN will match principals authenticated  with  names  of
  4894. any  type.   A  principal  authenticated with a name of type
  4895. UNKNOWN, however, will only match other names of  type  UNK-
  4896. NOWN.
  4897.  
  4898.      Names of any type with an initial component of "krbtgt"
  4899. are  reserved for the Kerberos ticket granting service.  See
  4900. section 8.2.3 for the form of such names.
  4901.  
  4902. _8.  _C_o_n_s_t_a_n_t_s _a_n_d _o_t_h_e_r _d_e_f_i_n_e_d _v_a_l_u_e_s
  4903.  
  4904.  
  4905. _8._1.  _H_o_s_t _a_d_d_r_e_s_s _t_y_p_e_s
  4906.  
  4907.      All negative values  for  the  host  address  type  are
  4908. reserved   for  local  use.   All  non-negative  values  are
  4909. reserved for officially assigned type fields and interpreta-
  4910. tions.
  4911.  
  4912.      The values of the types for the following addresses are
  4913. chosen  to match the defined address family constants in the
  4914. Berkeley Standard Distributions of Unix.  They can be  found
  4915. in  <sys/socket.h>  with symbolic names AF_xxx (where xxx is
  4916. an abbreviation of the address family name).
  4917.  
  4918.  
  4919. _I_n_t_e_r_n_e_t _a_d_d_r_e_s_s_e_s
  4920.  
  4921.      Internet addresses  are  32-bit  (4-octet)  quantities,
  4922. encoded in MSB order.  The type of internet addresses is two
  4923. (2).
  4924.  
  4925. _C_H_A_O_S_n_e_t _a_d_d_r_e_s_s_e_s
  4926.  
  4927.      CHAOSnet addresses  are  16-bit  (2-octet)  quantities,
  4928. encoded  in  MSB  order.   The type of CHAOSnet addresses is
  4929. five (5).
  4930.  
  4931.  
  4932.  
  4933.  
  4934. Section 8.1.               - 75 -   Expires 28 February 1993
  4935.  
  4936.  
  4937.  
  4938.  
  4939.  
  4940.  
  4941.                   Version 5 - Revision 5.1
  4942.  
  4943.  
  4944. _I_S_O _a_d_d_r_e_s_s_e_s
  4945.  
  4946.      ISO addresses are variable-length.   The  type  of  ISO
  4947. addresses is seven (7).
  4948.  
  4949. _X_e_r_o_x _N_e_t_w_o_r_k _S_e_r_v_i_c_e_s (_X_N_S) _a_d_d_r_e_s_s_e_s
  4950.  
  4951.      XNS addresses are 48-bit (6-octet) quantities,  encoded
  4952. in MSB order.  The type of XNS addresses is six (6).
  4953.  
  4954. _A_p_p_l_e_T_a_l_k _D_a_t_a_g_r_a_m _D_e_l_i_v_e_r_y _P_r_o_t_o_c_o_l (_D_D_P) _a_d_d_r_e_s_s_e_s
  4955.  
  4956.      AppleTalk DDP addresses consist of an 8-bit node number
  4957. and a 16-bit network number.  The first octet of the address
  4958. is the node number; the remaining two octets encode the net-
  4959. work  number  in  MSB  order.   The  type  of  AppleTalk DDP
  4960. addresses is sixteen (16).
  4961.  
  4962. _D_E_C_n_e_t _P_h_a_s_e _I_V _a_d_d_r_e_s_s_e_s
  4963.  
  4964.      DECnet Phase IV addresses are 16-bit addresses, encoded
  4965. in  LSB  order.   The  type  of DECnet Phase IV addresses is
  4966. twelve (12).
  4967.  
  4968. _8._2.  _K_D_C _m_e_s_s_a_g_e_s
  4969.  
  4970. _8._2._1.  _I_P _t_r_a_n_s_p_o_r_t
  4971.  
  4972.      When  contacting  a  Kerberos  server   (KDC)   for   a
  4973. KRB_KDC_REQ  request  using  IP  transport, the client shall
  4974. send a UDP datagram  containing  only  an  encoding  of  the
  4975. request  to  port  88 (decimal) at the KDC's IP address; the
  4976. KDC will respond with a reply datagram  containing  only  an
  4977. encoding  of  the  reply  message  (either  a KRB_ERROR or a
  4978. KRB_KDC_REP) to the sending port at the sender's IP address.
  4979.  
  4980. _8._2._2.  _O_S_I _t_r_a_n_s_p_o_r_t
  4981.  
  4982.      During authentication of  an  OSI  client  to  and  OSI
  4983. server, the mutual authentication of an OSI server to an OSI
  4984. client, or during exchange of private or  integrity  checked
  4985. messages,  Kerberos  protocol  messages  may  be  treated as
  4986. opaque objects and the type of the authentication  mechanism
  4987. will be:
  4988.  
  4989.          kerberos   OBJECT IDENTIFIER ::= { ?? ?? }
  4990.  
  4991. Depending on the situation, the opaque  object  will  be  an
  4992. authentication  header (KRB_AP_REQ), an authentication reply
  4993. (KRB_AP_REP), a safe message (KRB_SAFE), or a  private  mes-
  4994. sage  (KRB_PRIV).   The  opaque data contains an application
  4995. code as specified in the ASN.1 description for each message.
  4996. The  application  code  may be used by Kerberos to determine
  4997. the message type.
  4998.  
  4999.  
  5000. Section 8.2.2.             - 76 -   Expires 28 February 1993
  5001.  
  5002.  
  5003.  
  5004.  
  5005.  
  5006.  
  5007.                   Version 5 - Revision 5.1
  5008.  
  5009.  
  5010. _8._2._3.  _N_a_m_e _o_f _t_h_e _T_G_S
  5011.  
  5012.      The principal identifier of the ticket-granting service
  5013. shall  be  composed of three parts: (1) the realm of the KDC
  5014. issuing the TGS ticket (2) a two-part name of  type  NT-SRV-
  5015. INST,  with  the first part "krbtgt" and the second part the
  5016. name of the realm  which  will  accept  the  ticket-granting
  5017. ticket.  For example, a ticket-granting ticket issued by the
  5018. ATHENA.MIT.EDU realm to be used  to  get  tickets  from  the
  5019. ATHENA.MIT.EDU   KDC   has   a   principal   identifier   of
  5020. "ATHENA.MIT.EDU"   (realm),   ("krbtgt",   "ATHENA.MIT.EDU")
  5021. (name).     A   ticket-granting   ticket   issued   by   the
  5022. ATHENA.MIT.EDU realm to be used  to  get  tickets  from  the
  5023. MIT.EDU realm has a principal identifier of "ATHENA.MIT.EDU"
  5024. (realm), ("krbtgt", "MIT.EDU") (name).
  5025.  
  5026. _8._3.  _P_r_o_t_o_c_o_l _c_o_n_s_t_a_n_t_s _a_n_d _a_s_s_o_c_i_a_t_e_d _v_a_l_u_e_s
  5027.  
  5028.      The following tables list constants used in the  proto-
  5029. col and defines their meanings.
  5030.  
  5031. Encryption type                 _e_t_y_p_e value         block size      minimum pad size   confounder size
  5032. NULL                            0                   1               0                  0
  5033. des-cbc-crc                     1                   8               4                  8
  5034. des-cbc-md4                     2                   8               0                  8
  5035. des-cbc-md5                     3                   8               0                  8
  5036.  
  5037. Checksum type                   _s_u_m_t_y_p_e value       checksum size
  5038. CRC32                           1                   4
  5039. rsa-md4                         2                   16
  5040. rsa-md4-des                     3                   24
  5041. des-mac                         4                   16
  5042. des-mac-k                       5                   8
  5043. rsa-md4-des-k                   6                   16
  5044. rsa-md5                         7                   16
  5045. rsa-md5-des                     8                   24
  5046.  
  5047. padata type                     _p_a_d_a_t_a-_t_y_p_e value
  5048. PA-TGS-REQ                      1
  5049. PA-ENC-TIMESTAMPS               2
  5050. PA-PW-SALT                      3
  5051.  
  5052. authorization data type         _a_d-_t_y_p_e value
  5053. _r_e_s_e_r_v_e_d _v_a_l_u_e_s                 0-63
  5054. OSF-DCE                         64
  5055.  
  5056. alternate authentication type   _m_e_t_h_o_d-_t_y_p_e value
  5057. _r_e_s_e_r_v_e_d _v_a_l_u_e_s                 0-63
  5058. ATT-CHALLENGE-RESPONSE          64
  5059.  
  5060. transited encoding type         _t_r-_t_y_p_e value
  5061. DOMAIN-X500-COMPRESS            1
  5062. _r_e_s_e_r_v_e_d _v_a_l_u_e_s                 all others
  5063.  
  5064.  
  5065.  
  5066. Section 8.3.               - 77 -   Expires 28 February 1993
  5067.  
  5068.  
  5069.  
  5070.  
  5071.  
  5072.  
  5073.                   Version 5 - Revision 5.1
  5074.  
  5075.  
  5076. _L_a_b_e_l                          _V_a_l_u_e   _M_e_a_n_i_n_g _o_r _M_I_T _c_o_d_e
  5077.  
  5078. pvno                               5   current Kerberos protocol version number
  5079.  
  5080. message types
  5081.  
  5082. KRB_AS_REQ                        10   Request for initial authentication
  5083. KRB_AS_REP                        11   Response to KRB_AS_REQ request
  5084. KRB_TGS_REQ                       12   Request for authentication based on TGT
  5085. KRB_TGS_REP                       13   Response to KRB_TGS_REQ request
  5086. KRB_AP_REQ                        14   application request to server
  5087. KRB_AP_REP                        15   Response to KRB_AP_REQ_MUTUAL
  5088. KRB_SAFE                          20   Safe (checksummed) application message
  5089. KRB_PRIV                          21   Private (encrypted) application message
  5090.  
  5091. KRB_ERROR                         30   Error response
  5092.  
  5093. name types
  5094.  
  5095. KRB_NT_UNKNOWN                     0   Name type not known
  5096. KRB_NT_PRINCIPAL                   1   Just the name of the principal as in DCE, or for users
  5097. KRB_NT_SRV_INST                    2   Service and other unique instance (krbtgt)
  5098. KRB_NT_SRV_HST                     3   Service with host name as instance (telnet, rcommands)
  5099. KRB_NT_SRV_XHST                    4   Service with host as remaining components
  5100. KRB_NT_UID                         5   Unique ID
  5101.  
  5102. error codes
  5103.  
  5104. KDC_ERR_NONE                       0   No error
  5105. KDC_ERR_NAME_EXP                   1   Client's entry in database has expired
  5106. KDC_ERR_SERVICE_EXP                2   Server's entry in database has expired
  5107. KDC_ERR_BAD_PVNO                   3   Requested protocol version number
  5108.                                        not supported
  5109. KDC_ERR_C_OLD_MAST_KVNO            4   Client's key encrypted in
  5110.                                        old master key
  5111. KDC_ERR_S_OLD_MAST_KVNO            5   Server's key encrypted in
  5112.                                        old master key
  5113. KDC_ERR_C_PRINCIPAL_UNKNOWN        6   Client not found in Kerberos database
  5114. KDC_ERR_S_PRINCIPAL_UNKNOWN        7   Server not found in Kerberos database
  5115. KDC_ERR_PRINCIPAL_NOT_UNIQUE       8   Multiple entries for principal
  5116.                                        in Kerberos database
  5117. KDC_ERR_NULL_KEY                   9   The client or server has a null key
  5118. KDC_ERR_CANNOT_POSTDATE           10   Ticket not eligible for postdating
  5119. KDC_ERR_NEVER_VALID               11   Requested start time is later than end time
  5120. KDC_ERR_POLICY                    12   KDC policy rejects request
  5121. KDC_ERR_BADOPTION                 13   KDC cannot accommodate requested option
  5122. KDC_ERR_ETYPE_NOSUPP              14   KDC has no support for encryption type
  5123. KDC_ERR_SUMTYPE_NOSUPP            15   KDC has no support for checksum type
  5124. KDC_ERR_PADATA_TYPE_NOSUPP        16   KDC has no support for padata type
  5125. KDC_ERR_TRTYPE_NOSUPP             17   KDC has no support for transited type
  5126. KDC_ERR_CLIENT_REVOKED            18   Clients credentials have been revoked
  5127. KDC_ERR_SERVICE_REVOKED           19   Credentials for server have been revoked
  5128. KDC_ERR_TGT_REVOKED               20   TGT has been revoked
  5129. KDC_ERR_CLIENT_NOTYET             21   Client not yet valid - try again later
  5130.  
  5131.  
  5132. Section 8.3.               - 78 -   Expires 28 February 1993
  5133.  
  5134.  
  5135.  
  5136.  
  5137.  
  5138.  
  5139.                   Version 5 - Revision 5.1
  5140.  
  5141.  
  5142. KDC_ERR_SERVICE_NOTYET            22   Server not yet valid - try again later
  5143. KDC_ERR_KEY_EXPIRED               23   Password has expired - change password to reset
  5144.  
  5145. KRB_AP_ERR_BAD_INTEGRITY          31   Integrity check on decrypted field failed
  5146. KRB_AP_ERR_TKT_EXPIRED            32   Ticket expired
  5147. KRB_AP_ERR_TKT_NYV                33   Ticket not yet valid
  5148. KRB_AP_ERR_REPEAT                 34   Request is a replay
  5149. KRB_AP_ERR_NOT_US                 35   The ticket isn't for us
  5150. KRB_AP_ERR_BADMATCH               36   Ticket and authenticator don't match
  5151. KRB_AP_ERR_SKEW                   37   Clock skew too great
  5152. KRB_AP_ERR_BADADDR                38   Incorrect net address
  5153. KRB_AP_ERR_BADVERSION             39   Protocol version mismatch
  5154. KRB_AP_ERR_MSG_TYPE               40   Invalid msg type
  5155. KRB_AP_ERR_MODIFIED               41   Message stream modified
  5156. KRB_AP_ERR_BADORDER               42   Message out of order
  5157. KRB_AP_ERR_BADKEYVER              44   Specified version of key is not available
  5158. KRB_AP_ERR_NOKEY                  45   Service key not available
  5159. KRB_AP_ERR_MUT_FAIL               46   Mutual authentication failed
  5160. KRB_AP_ERR_BADDIRECTION           47   Incorrect message direction
  5161. KRB_AP_ERR_METHOD                 48   Alternative authentication method required[36]
  5162. KRB_AP_ERR_BADSEQ                 49   Incorrect sequence number in message
  5163. KRB_AP_ERR_INAPP_CKSUM            50   Inappropriate type of checksum in message
  5164.  
  5165. KRB_ERR_GENERIC                   60   Generic error (description in e-text)
  5166. KRB_ERR_FIELD_TOOLONG             61   Field is too long for this implementation
  5167.  
  5168.  
  5169.  
  5170.  
  5171.  
  5172. _9.  _I_n_t_e_r_o_p_e_r_a_b_i_l_i_t_y _r_e_q_u_i_r_e_m_e_n_t_s
  5173.  
  5174.      Version 5 of the Kerberos protocol supports a myriad of
  5175. options.   Among  these are multiple encryption and checksum
  5176. types, alternative encoding schemes for the transited field,
  5177. optional  mechanisms for pre-authentication, the handling of
  5178. tickets with no addresses, options  for  mutual  authentica-
  5179. tion, user to user authentication, support for proxies, for-
  5180. warding, postdating, and renewing  tickets,  the  format  of
  5181. realm names, and the handling of authorization data.
  5182.  
  5183.      In order to ensure the interoperability of  realms,  it
  5184. is necessary to define a minimal configuration which must be
  5185. supported by all implementations.  This  minimal  configura-
  5186. tion  is subject to change as technology does.  For example,
  5187. if at some later date it  is  discovered  that  one  of  the
  5188. required encryption or checksum algorithms is not secure, it
  5189. will be replaced.
  5190. __________________________
  5191. [36] This error carries additional information  in  the
  5192. e-data field.  The contents of the e-data field will be
  5193. an encoding of the METHOD-DATA  sequence  (see  section
  5194. 5.8.1).
  5195.  
  5196. Section 9.                 - 79 -   Expires 28 February 1993
  5197.  
  5198.  
  5199.  
  5200.  
  5201.  
  5202.  
  5203.                   Version 5 - Revision 5.1
  5204.  
  5205.  
  5206. _9._1.  _S_p_e_c_i_f_i_c_a_t_i_o_n _1
  5207.  
  5208.      This section defines the first specification  of  these
  5209. options.   Implementations  which are configured in this way
  5210. can be said to support Kerberos Version  5  Specification  1
  5211. (5.1).
  5212.  
  5213. _E_n_c_r_y_p_t_i_o_n _a_n_d _c_h_e_c_k_s_u_m _m_e_t_h_o_d_s
  5214.  
  5215. The following encryption and  checksum  mechanisms  must  be
  5216. supported.   Implementations may support other mechanisms as
  5217. well, but the additional mechanisms may only  be  used  when
  5218. communicating with principals known to also support them:
  5219. Encryption: DES-CBC-MD5
  5220. Checksums: CRC-32, DES-MAC, DES-MAC-K, and DES-MD5
  5221.  
  5222. _R_e_a_l_m _N_a_m_e_s
  5223.  
  5224. All implementations must understand hierarchical  realms  in
  5225. both the Internet Domain and the X.500 style.  When a ticket
  5226. granting ticket for an unknown realm is requested,  the  KDC
  5227. must  be  able  to  determine  the names of the intermediate
  5228. realms between the KDCs realm and the requested realm.
  5229.  
  5230. _T_r_a_n_s_i_t_e_d _f_i_e_l_d _e_n_c_o_d_i_n_g
  5231.  
  5232. DOMAIN-X500-COMPRESS (described in section 3.3.3.1) must  be
  5233. supported.  Alternative encodings may be supported, but they
  5234. may be used only when that  encoding  is  supported  by  ALL
  5235. intermediate realms.
  5236.  
  5237. _P_r_e-_a_u_t_h_e_n_t_i_c_a_t_i_o_n _m_e_t_h_o_d_s
  5238.  
  5239. The TGS-REQ method must be supported.  The TGS-REQ method is
  5240. not used on the initial request.
  5241.  
  5242.  
  5243. _M_u_t_u_a_l _a_u_t_h_e_n_t_i_c_a_t_i_o_n
  5244.  
  5245. Mutual authentication (via the KRB_AP_REP message)  must  be
  5246. supported.
  5247.  
  5248.  
  5249. _T_i_c_k_e_t _a_d_d_r_e_s_s_e_s _a_n_d _f_l_a_g_s
  5250.  
  5251. All KDC's must pass on tickets that carry no addresses (i.e.
  5252. if  a TGT contains no addresses, the KDC will return deriva-
  5253. tive tickets), but each realm may set  its  own  policy  for
  5254. issuing  such  tickets, and each application server will set
  5255. its own policy with respect to accepting them.  By  default,
  5256. servers should not accept them.
  5257.  
  5258.      Proxies and forwarded tickets must be supported.  Indi-
  5259. vidual  realms  and  application  servers  can set their own
  5260.  
  5261.  
  5262. Section 9.1.               - 80 -   Expires 28 February 1993
  5263.  
  5264.  
  5265.  
  5266.  
  5267.  
  5268.  
  5269.                   Version 5 - Revision 5.1
  5270.  
  5271.  
  5272. policy on when such tickets will be accepted.
  5273.  
  5274.      All implementations must recognize renewable and  post-
  5275. dated  tickets,  but  need  not actually implement them.  If
  5276. these options are not supported, the starttime  and  endtime
  5277. in  the  ticket shall specify a ticket's entire useful life.
  5278. When a postdated ticket is decoded by a server,  all  imple-
  5279. mentations  shall  make  the  presence of the postdated flag
  5280. visible to the calling server.
  5281.  
  5282. _U_s_e_r-_t_o-_u_s_e_r _a_u_t_h_e_n_t_i_c_a_t_i_o_n
  5283.  
  5284. Support for user to user authentication  (via  the  ENC-TKT-
  5285. IN-SKEY KDC option) is not required.
  5286.  
  5287. _A_u_t_h_o_r_i_z_a_t_i_o_n _d_a_t_a
  5288.  
  5289. Implementations must pass all authorization  data  subfields
  5290. from  ticket-granting  tickets  to  any  derivative  tickets
  5291. unless directed to suppress a subfield as part of the defin-
  5292. ition   of  that  registered  subfield  type  (it  is  never
  5293. incorrect to pass on a subfield, and no registered  subfield
  5294. types presently specify suppression at the KDC).
  5295.  
  5296.      Implementations must make the contents of any  authori-
  5297. zation  data subfields available to the server when a ticket
  5298. is used.  Implementations are not required to allow  clients
  5299. to specify the contents of the authorization data fields.
  5300.  
  5301. _9._2.  _R_e_c_o_m_m_e_n_d_e_d _K_D_C _v_a_l_u_e_s
  5302.  
  5303. Following is a list of recommended values for a  KDC  imple-
  5304. mentation, based on the list of suggested configuration con-
  5305. stants (see section 4.4).
  5306.  
  5307. minimum lifetime    5 minutes
  5308.  
  5309. maximum renewable lifetime1 week
  5310.  
  5311. maximum ticket lifetime1 day
  5312.  
  5313. empty addresses     only when suitable  restrictions  appear
  5314.                     in authorization data
  5315.  
  5316. proxiable, etc.     Allowed.
  5317.  
  5318. _1_0.  _A_c_k_n_o_w_l_e_d_g_m_e_n_t_s
  5319.  
  5320.      Early versions of this document, describing  version  4
  5321. of  the protocol, were written by Jennifer Steiner (formerly
  5322. at Project  Athena);  these  drafts  provided  an  excellent
  5323. starting  point  for  this  current version 5 specification.
  5324. Many people in the Internet community have contributed ideas
  5325. and  suggested  protocol  changes  for  version  5.  Notable
  5326.  
  5327.  
  5328. Section 10.                - 81 -   Expires 28 February 1993
  5329.  
  5330.  
  5331.  
  5332.  
  5333.  
  5334.  
  5335.                   Version 5 - Revision 5.1
  5336.  
  5337.  
  5338. contributions came from Ted  Anderson,  Steve  Bellovin  and
  5339. Michael Merritt [16], Daniel Bernstein, Mike Burrows, Donald
  5340. Davis, Morrie Gasser, Virgil  Gligor,  Bill  Griffeth,  Mark
  5341. Lillibridge,  Mark  Lomas,  Joe  Pato,  William  Sommerfeld,
  5342. Stuart Stubblebine,  Ralph  Swick,  and  Stanley  Zanarotti.
  5343. Many  others  commented  and helped shape this specification
  5344. into its current form.
  5345.  
  5346. _1_1.  _R_E_F_E_R_E_N_C_E_S
  5347.  
  5348.  
  5349.  
  5350. 1.   S. P. Miller, B. C. Neuman, J. I. Schiller, and  J.  H.
  5351.      Saltzer,  _S_e_c_t_i_o_n  _E._2._1:  _K_e_r_b_e_r_o_s  _A_u_t_h_e_n_t_i_c_a_t_i_o_n _a_n_d
  5352.      _A_u_t_h_o_r_i_z_a_t_i_o_n _S_y_s_t_e_m, M.I.T. Project Athena, Cambridge,
  5353.      Massachusetts (December 21, 1987).
  5354.  
  5355. 2.   J. G. Steiner, B. C. Neuman, and J. I. Schiller,  "Ker-
  5356.      beros:  An Authentication Service for Open Network Sys-
  5357.      tems," pp. 191-202 in  _U_s_e_n_i_x  _C_o_n_f_e_r_e_n_c_e  _P_r_o_c_e_e_d_i_n_g_s,
  5358.      Dallas, Texas (February, 1988).
  5359.  
  5360. 3.   Roger M.  Needham  and  Michael  D.  Schroeder,  "Using
  5361.      Encryption for Authentication in Large Networks of Com-
  5362.      puters,"  _C_o_m_m_u_n_i_c_a_t_i_o_n_s  _o_f  _t_h_e  _A_C_M,  Vol.   21(12),
  5363.      pp. 993-999 (December, 1978).
  5364.  
  5365. 4.   Dorothy E. Denning and  Giovanni  Maria  Sacco,  "Time-
  5366.      stamps  in  Key Distribution Protocols," _C_o_m_m_u_n_i_c_a_t_i_o_n_s
  5367.      _o_f _t_h_e _A_C_M, Vol. 24(8), pp. 533-536 (August 1981).
  5368.  
  5369. 5.   John T. Kohl, B. Clifford Neuman, and Theodore Y. Ts'o,
  5370.      "The Evolution of the Kerberos Authentication Service,"
  5371.      in _a_n _I_E_E_E _C_o_m_p_u_t_e_r _S_o_c_i_e_t_y _T_e_x_t _s_o_o_n _t_o  _b_e  _p_u_b_l_i_s_h_e_d
  5372.      (June 1992).
  5373.  
  5374. 6.   Don Davis and Ralph Swick,  "Workstation  Services  and
  5375.      Kerberos  Authentication  at Project Athena," Technical
  5376.      Memorandum TM-424,  MIT Laboratory for Computer Science
  5377.      (February 1990).
  5378.  
  5379. 7.   P. J. Levine, M. R. Gretzinger, J. M. Diaz, W. E.  Som-
  5380.      merfeld,  and  K. Raeburn, _S_e_c_t_i_o_n _E._1: _S_e_r_v_i_c_e _M_a_n_a_g_e_-
  5381.      _m_e_n_t _S_y_s_t_e_m, M.I.T.  Project  Athena,  Cambridge,  Mas-
  5382.      sachusetts (1987).
  5383.  
  5384. 8.   CCITT, _R_e_c_o_m_m_e_n_d_a_t_i_o_n _X._5_0_9: _T_h_e _D_i_r_e_c_t_o_r_y  _A_u_t_h_e_n_t_i_c_a_-
  5385.      _t_i_o_n _F_r_a_m_e_w_o_r_k, December 1988.
  5386.  
  5387. 9.   B.  Clifford  Neuman,  "Proxy-Based  Authorization  and
  5388.      Accounting  for  Distributed Systems," Technical Report
  5389.      91-02-01,  Department of Computer Science and Engineer-
  5390.      ing, University of Washington (March 1991).
  5391.  
  5392.  
  5393.  
  5394. Section 11.                - 82 -   Expires 28 February 1993
  5395.  
  5396.  
  5397.  
  5398.  
  5399.  
  5400.  
  5401.                   Version 5 - Revision 5.1
  5402.  
  5403.  
  5404. 10.  National Bureau of Standards, U.S. Department  of  Com-
  5405.      merce,  "Data Encryption Standard," Federal Information
  5406.      Processing Standards Publication  46,   Washington,  DC
  5407.      (1977).
  5408.  
  5409. 11.  National Bureau of Standards, U.S. Department  of  Com-
  5410.      merce,  "DES  Modes  of Operation," Federal Information
  5411.      Processing Standards Publication 81,   Springfield,  VA
  5412.      (December 1980).
  5413.  
  5414. 12.  Stuart G. Stubblebine and Virgil D. Gligor, "On Message
  5415.      Integrity  in  Cryptographic Protocols," in _P_r_o_c_e_e_d_i_n_g_s
  5416.      _o_f _t_h_e _I_E_E_E  _S_y_m_p_o_s_i_u_m  _o_n  _R_e_s_e_a_r_c_h  _i_n  _S_e_c_u_r_i_t_y  _a_n_d
  5417.      _P_r_i_v_a_c_y, Oakland, California (May 1992).
  5418.  
  5419. 13.  International Organization  for  Standardization,  "ISO
  5420.      Information  Processing  Systems - Data Communication -
  5421.      High-Level Data Link Control Procedure -  Frame  Struc-
  5422.      ture," IS 3309 (October 1984).  3rd Edition.
  5423.  
  5424. 14.  R. Rivest, "The  MD4  Message  Digest  Algorithm,"  RFC
  5425.      1320,   MIT  Laboratory  for  Computer  Science  (April
  5426.      1992).
  5427.  
  5428. 15.  R. Rivest, "The  MD5  Message  Digest  Algorithm,"  RFC
  5429.      1321,   MIT  Laboratory  for  Computer  Science  (April
  5430.      1992).
  5431.  
  5432. 16.  S. M. Bellovin and M. Merritt, "Limitations of the Ker-
  5433.      beros  Authentication  System," _C_o_m_p_u_t_e_r _C_o_m_m_u_n_i_c_a_t_i_o_n_s
  5434.      _R_e_v_i_e_w, Vol. 20(5), pp. 119-132 (October 1990).
  5435.  
  5436.  
  5437.  
  5438.  
  5439.  
  5440.  
  5441.  
  5442.  
  5443.  
  5444.  
  5445.  
  5446.  
  5447.  
  5448.  
  5449.  
  5450.  
  5451.  
  5452.  
  5453.  
  5454.  
  5455.  
  5456.  
  5457.  
  5458.  
  5459.  
  5460. Section 11.                - 83 -   Expires 28 February 1993
  5461.  
  5462.  
  5463.  
  5464.  
  5465.  
  5466.                   Version 5 - Revision 5.1
  5467.  
  5468.  
  5469.  
  5470. A.  Pseudo-code for protocol processing
  5471.  
  5472.      This appendix provides pseudo-code describing  how  the
  5473. messages  are  to  be constructed and interpreted by clients
  5474. and servers.
  5475.  
  5476. A.1.  KRB_AS_REQ generation
  5477.         request.pvno := protocol version; /* pvno = 5 */
  5478.         request.msg-type := message type; /* type = KRB_AS_REQ */
  5479.  
  5480.         body.kdc-options := users's preferences;
  5481.         body.cname := user's name;
  5482.         body.realm := user's realm;
  5483.         body.sname := service's name; /* usually "krbtgt",  "localrealm" */
  5484.         if (body.kdc-options.POSTDATED is set) then
  5485.                 body.from := requested starting time;
  5486.         else
  5487.                 omit body.from;
  5488.         endif
  5489.         body.till := requested end time;
  5490.         if (body.kdc-options.RENEWABLE is set) then
  5491.                 body.rtime := requested final renewal time;
  5492.         endif
  5493.         body.nonce := random_nonce();
  5494.         body.etype := requested etypes;
  5495.         if (user supplied addresses) then
  5496.                 body.addresses := user's addresses;
  5497.         else
  5498.                 omit body.addresses;
  5499.         endif
  5500.         omit body.enc-authorization-data;
  5501.         request.req-body := body;
  5502.  
  5503.         kerberos := lookup(name of local kerberos server (or servers));
  5504.         send(packet,kerberos);
  5505.  
  5506.         wait(for response);
  5507.         if (timed_out) then
  5508.                 retry or use alternate server;
  5509.         endif
  5510.  
  5511. A.2.  KRB_AS_REQ verification and KRB_AS_REP generation
  5512.         decode message into req;
  5513.  
  5514.         client := lookup(req.cname,req.realm);
  5515.         server := lookup(req.sname,req.realm);
  5516.  
  5517.         get system_time;
  5518.         kdc_time := system_time.seconds;
  5519.  
  5520.         if (!client) then
  5521.                 /* no client in Database */
  5522.                 error_out(KDC_ERR_C_PRINCIPAL_UNKNOWN);
  5523.         endif
  5524.  
  5525.  
  5526. Section A.2.               - 84 -   Expires 28 February 1993
  5527.  
  5528.  
  5529.  
  5530.  
  5531.  
  5532.  
  5533.                   Version 5 - Revision 5.1
  5534.  
  5535.  
  5536.         if (!server) then
  5537.                 /* no server in Database */
  5538.                 error_out(KDC_ERR_S_PRINCIPAL_UNKNOWN);
  5539.         endif
  5540.  
  5541.         use_etype := first supported etype in req.etypes;
  5542.  
  5543.         if (no support for req.etypes) then
  5544.                 error_out(KDC_ERR_ETYPE_NOSUPP);
  5545.         endif
  5546.  
  5547.         new_tkt.vno := ticket version; /* = 5 */
  5548.         new_tkt.sname := req.sname;
  5549.         new_tkt.srealm := req.srealm;
  5550.         reset all flags in new_tkt.flags;
  5551.  
  5552.         /* It should be noted that local policy may affect the  */
  5553.         /* processing of any of these flags.  For example, some */
  5554.         /* realms may refuse to issue renewable tickets         */
  5555.  
  5556.         if (req.kdc-options.FORWARDABLE is set) then
  5557.                 set new_tkt.flags.FORWARDABLE;
  5558.         endif
  5559.         if (req.kdc-options.PROXIABLE is set) then
  5560.                 set new_tkt.flags.PROXIABLE;
  5561.         endif
  5562.         if (req.kdc-options.ALLOW-POSTDATE is set) then
  5563.                 set new_tkt.flags.ALLOW-POSTDATE;
  5564.         endif
  5565.         if ((req.kdc-options.RENEW is set) or
  5566.             (req.kdc-options.VALIDATE is set) or
  5567.             (req.kdc-options.PROXY is set) or
  5568.             (req.kdc-options.FORWARDED is set) or
  5569.             (req.kdc-options.ENC-TKT-IN-SKEY is set)) then
  5570.                 error_out(KDC_ERR_BADOPTION);
  5571.         endif
  5572.  
  5573.         new_tkt.session := random_session_key();
  5574.         new_tkt.cname := req.cname;
  5575.         new_tkt.crealm := req.crealm;
  5576.         new_tkt.transited := empty_transited_field();
  5577.  
  5578.         new_tkt.authtime := kdc_time;
  5579.  
  5580.         if (req.kdc-options.POSTDATED is set) then
  5581.            if (against_postdate_policy(req.from)) then
  5582.                 error_out(KDC_ERR_POLICY);
  5583.            endif
  5584.            set new_tkt.flags.INVALID;
  5585.            new_tkt.starttime := req.from;
  5586.         else
  5587.            omit new_tkt.starttime; /* treated as authtime when omitted */
  5588.         endif
  5589.         if (req.till = 0) then
  5590.  
  5591.  
  5592. Section A.2.               - 85 -   Expires 28 February 1993
  5593.  
  5594.  
  5595.  
  5596.  
  5597.  
  5598.  
  5599.                   Version 5 - Revision 5.1
  5600.  
  5601.  
  5602.                 till := infinity;
  5603.         else
  5604.                 till := req.till;
  5605.         endif
  5606.  
  5607.         new_tkt.endtime := min(till,
  5608.                               new_tkt.starttime+client.max_life,
  5609.                               new_tkt.starttime+server.max_life,
  5610.                               new_tkt.starttime+max_life_for_realm);
  5611.  
  5612.         if ((req.kdc-options.RENEWABLE-OK is set) and
  5613.             (new_tkt.endtime < req.till)) then
  5614.                 /* we set the RENEWABLE option for later processing */
  5615.                 set req.kdc-options.RENEWABLE;
  5616.                 req.rtime := req.till;
  5617.         endif
  5618.  
  5619.         if (req.rtime = 0) then
  5620.                 rtime := infinity;
  5621.         else
  5622.                 rtime := req.rtime;
  5623.         endif
  5624.  
  5625.         if (req.kdc-options.RENEWABLE is set) then
  5626.                 set new_tkt.flags.RENEWABLE;
  5627.                 new_tkt.renew-till := min(rtime,
  5628.                                           new_tkt.starttime+client.max_rlife,
  5629.                                           new_tkt.starttime+server.max_rlife,
  5630.                                           new_tkt.starttime+max_rlife_for_realm);
  5631.         else
  5632.                 omit new_tkt.renew-till; /* only present if RENEWABLE */
  5633.         endif
  5634.  
  5635.         if (req.addresses) then
  5636.                 new_tkt.caddr := req.addresses;
  5637.         else
  5638.                 omit new_tkt.caddr;
  5639.         endif
  5640.  
  5641.         new_tkt.authorization_data := empty_authorization_data();
  5642.  
  5643.         encode to-be-encrypted part of ticket into OCTET STRING;
  5644.         new_tkt.enc-part := encrypt OCTET STRING
  5645.                 using etype_for_key(server.key), server.key, server.p_kvno;
  5646.  
  5647.  
  5648.         /* Start processing the response */
  5649.  
  5650.         resp.pvno := 5;
  5651.         resp.msg-type := KRB_AS_REP;
  5652.         resp.cname := req.cname;
  5653.         resp.crealm := req.realm;
  5654.         resp.ticket := new_tkt;
  5655.  
  5656.  
  5657.  
  5658. Section A.2.               - 86 -   Expires 28 February 1993
  5659.  
  5660.  
  5661.  
  5662.  
  5663.  
  5664.  
  5665.                   Version 5 - Revision 5.1
  5666.  
  5667.  
  5668.         resp.key := new_tkt.session;
  5669.         resp.last-req := fetch_last_request_info(client);
  5670.         resp.nonce := req.nonce;
  5671.         resp.key-expiration := client.expiration;
  5672.         resp.flags := new_tkt.flags;
  5673.  
  5674.         resp.authtime := new_tkt.authtime;
  5675.         resp.starttime := new_tkt.starttime;
  5676.         resp.endtime := new_tkt.endtime;
  5677.  
  5678.         if (new_tkt.flags.RENEWABLE) then
  5679.                 resp.renew-till := new_tkt.renew-till;
  5680.         endif
  5681.  
  5682.         resp.realm := new_tkt.realm;
  5683.         resp.sname := new_tkt.sname;
  5684.  
  5685.         resp.caddr := new_tkt.caddr;
  5686.  
  5687.         encode body of reply into OCTET STRING;
  5688.  
  5689.         resp.enc-part := encrypt OCTET STRING
  5690.                          using use_etype, client.key, client.p_kvno;
  5691.         send(resp);
  5692.  
  5693. A.3.  KRB_AS_REP verification
  5694.         decode response into resp;
  5695.  
  5696.         if (resp.msg-type = KRB_ERROR) then
  5697.                 process_error(resp);
  5698.                 return;
  5699.         endif
  5700.  
  5701.         /* On error, discard the response, and zero the session key */
  5702.         /* from the response immediately */
  5703.  
  5704.         key = get_decryption_key(resp.enc-part.kvno, resp.enc-part.etype,
  5705.                                  resp.padata);
  5706.         unencrypted part of resp := decode of decrypt of resp.enc-part
  5707.                                 using resp.enc-part.etype and key;
  5708.         zero(key);
  5709.  
  5710.         if (common_as_rep_tgs_rep_checks fail) then
  5711.                 destroy resp.key;
  5712.                 return error;
  5713.         endif
  5714.  
  5715.         if near(resp.princ_exp) then
  5716.                 print(warning message);
  5717.         endif
  5718.         save_for_later(ticket,session,client,server,times,flags);
  5719.  
  5720.  
  5721.  
  5722.  
  5723.  
  5724. Section A.3.               - 87 -   Expires 28 February 1993
  5725.  
  5726.  
  5727.  
  5728.  
  5729.  
  5730.  
  5731.                   Version 5 - Revision 5.1
  5732.  
  5733.  
  5734. A.4.  KRB_AS_REP and KRB_TGS_REP common checks
  5735.         if (decryption_error() or
  5736.             (req.cname != resp.cname) or
  5737.             (req.realm != resp.crealm) or
  5738.             (req.sname != resp.sname) or
  5739.             (req.realm != resp.realm) or
  5740.             (req.nonce != resp.nonce) or
  5741.             (req.addresses != resp.caddr)) then
  5742.                 destroy resp.key;
  5743.                 return KRB_AP_ERR_MODIFIED;
  5744.         endif
  5745.  
  5746.         /* make sure no flags are set that shouldn't be, and that all that */
  5747.         /* should be are set                                               */
  5748.         if (!check_flags_for_compatability(req.kdc-options,resp.flags)) then
  5749.                 destroy resp.key;
  5750.                 return KRB_AP_ERR_MODIFIED;
  5751.         endif
  5752.  
  5753.         if ((req.from = 0) and
  5754.             (resp.starttime is not within allowable skew)) then
  5755.                 destroy resp.key;
  5756.                 return KRB_AP_ERR_SKEW;
  5757.         endif
  5758.         if ((req.from != 0) and (req.from != resp.starttime)) then
  5759.                 destroy resp.key;
  5760.                 return KRB_AP_ERR_MODIFIED;
  5761.         endif
  5762.         if ((req.till != 0) and (resp.endtime > req.till)) then
  5763.                 destroy resp.key;
  5764.                 return KRB_AP_ERR_MODIFIED;
  5765.         endif
  5766.  
  5767.         if ((req.kdc-options.RENEWABLE is set) and
  5768.             (req.rtime != 0) and (resp.renew-till > req.rtime)) then
  5769.                 destroy resp.key;
  5770.                 return KRB_AP_ERR_MODIFIED;
  5771.         endif
  5772.         if ((req.kdc-options.RENEWABLE-OK is set) and
  5773.             (resp.flags.RENEWABLE) and
  5774.             (req.till != 0) and
  5775.             (resp.renew-till > req.till)) then
  5776.                 destroy resp.key;
  5777.                 return KRB_AP_ERR_MODIFIED;
  5778.         endif
  5779.  
  5780. A.5.  KRB_TGS_REQ generation
  5781.         /* Note that make_application_request might have to recursivly     */
  5782.         /* call this routine to get the appropriate ticket-granting ticket */
  5783.  
  5784.         request.pvno := protocol version; /* pvno = 5 */
  5785.         request.msg-type := message type; /* type = KRB_TGS_REQ */
  5786.  
  5787.         body.kdc-options := users's preferences;
  5788.  
  5789.  
  5790. Section A.5.               - 88 -   Expires 28 February 1993
  5791.  
  5792.  
  5793.  
  5794.  
  5795.  
  5796.  
  5797.                   Version 5 - Revision 5.1
  5798.  
  5799.  
  5800.         body.sname := service's name;
  5801.  
  5802.         if (body.kdc-options.POSTDATED is set) then
  5803.                 body.from := requested starting time;
  5804.         else
  5805.                 omit body.from;
  5806.         endif
  5807.         body.till := requested end time;
  5808.         if (body.kdc-options.RENEWABLE is set) then
  5809.                 body.rtime := requested final renewal time;
  5810.         endif
  5811.         body.nonce := random_nonce();
  5812.         body.etype := requested etypes;
  5813.         if (user supplied addresses) then
  5814.                 body.addresses := user's addresses;
  5815.         else
  5816.                 omit body.addresses;
  5817.         endif
  5818.  
  5819.         body.enc-authorization-data := user-supplied data;
  5820.         if (body.kdc-options.ENC-TKT-IN-SKEY) then
  5821.                 body.additional-tickets_ticket := second TGT;
  5822.         endif
  5823.  
  5824.         request.req-body := body;
  5825.         check := generate_checksum (req.body,checksumtype);
  5826.  
  5827.         request.padata[0].padata-type := PA-TGS-REQ;
  5828.         request.padata[0].padata-value := create a KRB_AP_REQ using
  5829.                                       the TGT and checksum
  5830.  
  5831.         /* add in any other padata as required/supplied */
  5832.  
  5833.         kerberos := lookup(name of local kerberose server (or servers));
  5834.         send(packet,kerberos);
  5835.  
  5836.         wait(for response);
  5837.         if (timed_out) then
  5838.                 retry or use alternate server;
  5839.         endif
  5840.  
  5841. A.6.  KRB_TGS_REQ verification and KRB_TGS_REP generation
  5842.         /* note that reading the application request requires first
  5843.         determining the server for which a ticket was issued, and choosing the
  5844.         correct key for decryption.  The name of the server appears in the
  5845.         plaintext part of the ticket. */
  5846.  
  5847.         if (no KRB_AP_REQ in req.padata) then
  5848.                 error_out(KDC_ERR_PADATA_TYPE_NOSUPP);
  5849.         endif
  5850.         verify KRB_AP_REQ in req.padata;
  5851.  
  5852.         /* Note that the realm in which the Kerberos server is operating is
  5853.         determined by the instance from the ticket-granting ticket.  The realm
  5854.  
  5855.  
  5856. Section A.6.               - 89 -   Expires 28 February 1993
  5857.  
  5858.  
  5859.  
  5860.  
  5861.  
  5862.  
  5863.                   Version 5 - Revision 5.1
  5864.  
  5865.  
  5866.         in the ticket-granting ticket is the realm under which the ticket
  5867.         granting ticket was issued.  It is possible for a single Kerberos
  5868.         server to support more than one realm. */
  5869.  
  5870.         auth_hdr := KRB_AP_REQ;
  5871.         tgt := auth_hdr.ticket;
  5872.  
  5873.         if (tgt.sname is not a TGT for local realm and is not req.sname) then
  5874.           error_out(KRB_AP_ERR_NOT_US);
  5875.  
  5876.         realm := realm_tgt_is_for(tgt);
  5877.  
  5878.         decode remainder of request;
  5879.  
  5880.         if (auth_hdr.authenticator.cksum type is not supported) then
  5881.                 error_out(KDC_ERR_SUMTYPE_NOSUPP);
  5882.         endif
  5883.         if (auth_hdr.authenticator.cksum is not both collision-proof and keyed) then
  5884.                 error_out(KRB_AP_ERR_INAPP_CKSUM);
  5885.         endif
  5886.         server := lookup(req.sname,realm);
  5887.  
  5888.         if (!server) then
  5889.                 if (is_foreign_tgt_name(server)) then
  5890.                         server := best_intermediate_tgs(server);
  5891.                 else
  5892.                         /* no server in Database */
  5893.                         error_out(KDC_ERR_S_PRINCIPAL_UNKNOWN);
  5894.                 endif
  5895.         endif
  5896.  
  5897.         session := generate_random_session_key();
  5898.  
  5899.  
  5900.         use_etype := first supported etype in req.etypes;
  5901.  
  5902.         if (no support for req.etypes) then
  5903.                 error_out(KDC_ERR_ETYPE_NOSUPP);
  5904.         endif
  5905.  
  5906.         new_tkt.vno := ticket version; /* = 5 */
  5907.         new_tkt.sname := req.sname;
  5908.         new_tkt.srealm := realm;
  5909.         reset all flags in new_tkt.flags;
  5910.  
  5911.         /* It should be noted that local policy may affect the  */
  5912.         /* processing of any of these flags.  For example, some */
  5913.         /* realms may refuse to issue renewable tickets         */
  5914.  
  5915.         new_tkt.caddr := tgt.caddr;
  5916.         resp.caddr := NULL; /* We only include this if they change */
  5917.         if (req.kdc-options.FORWARDABLE is set) then
  5918.                 if (tgt.flags.FORWARDABLE is reset) then
  5919.                         error_out(KDC_ERR_BADOPTION);
  5920.  
  5921.  
  5922. Section A.6.               - 90 -   Expires 28 February 1993
  5923.  
  5924.  
  5925.  
  5926.  
  5927.  
  5928.  
  5929.                   Version 5 - Revision 5.1
  5930.  
  5931.  
  5932.                 endif
  5933.                 set new_tkt.flags.FORWARDABLE;
  5934.         endif
  5935.         if (req.kdc-options.FORWARDED is set) then
  5936.                 if (tgt.flags.FORWARDABLE is reset) then
  5937.                         error_out(KDC_ERR_BADOPTION);
  5938.                 endif
  5939.                 set new_tkt.flags.FORWARDED;
  5940.                 new_tkt.caddr := req.addresses;
  5941.                 resp.caddr := req.addresses;
  5942.         endif
  5943.         if (tgt.flags.FORWARDED is set) then
  5944.                 set new_tkt.flags.FORWARDED;
  5945.         endif
  5946.  
  5947.         if (req.kdc-options.PROXIABLE is set) then
  5948.                 if (tgt.flags.PROXIABLE is reset)
  5949.                         error_out(KDC_ERR_BADOPTION);
  5950.                 endif
  5951.                 set new_tkt.flags.PROXIABLE;
  5952.         endif
  5953.         if (req.kdc-options.PROXY is set) then
  5954.                 if (tgt.flags.PROXIABLE is reset) then
  5955.                         error_out(KDC_ERR_BADOPTION);
  5956.                 endif
  5957.                 set new_tkt.flags.PROXY;
  5958.                 new_tkt.caddr := req.addresses;
  5959.                 resp.caddr := req.addresses;
  5960.         endif
  5961.  
  5962.         if (req.kdc-options.POSTDATE is set) then
  5963.                 if (tgt.flags.POSTDATE is reset)
  5964.                         error_out(KDC_ERR_BADOPTION);
  5965.                 endif
  5966.                 set new_tkt.flags.POSTDATE;
  5967.         endif
  5968.         if (req.kdc-options.POSTDATED is set) then
  5969.                 if (tgt.flags.POSTDATE is reset) then
  5970.                         error_out(KDC_ERR_BADOPTION);
  5971.                 endif
  5972.                 set new_tkt.flags.POSTDATED;
  5973.                 set new_tkt.flags.INVALID;
  5974.                 if (against_postdate_policy(req.from)) then
  5975.                         error_out(KDC_ERR_POLICY);
  5976.                 endif
  5977.                 new_tkt.starttime := req.from;
  5978.         endif
  5979.  
  5980.  
  5981.         if (req.kdc-options.VALIDATE is set) then
  5982.                 if (tgt.flags.INVALID is reset) then
  5983.                         error_out(KDC_ERR_POLICY);
  5984.                 endif
  5985.                 if (tgt.starttime > kdc_time) then
  5986.  
  5987.  
  5988. Section A.6.               - 91 -   Expires 28 February 1993
  5989.  
  5990.  
  5991.  
  5992.  
  5993.  
  5994.  
  5995.                   Version 5 - Revision 5.1
  5996.  
  5997.  
  5998.                         error_out(KRB_AP_ERR_NYV);
  5999.                 endif
  6000.                 if (check_hot_list(tgt)) then
  6001.                         error_out(KRB_AP_ERR_REPEAT);
  6002.                 endif
  6003.                 tkt := tgt;
  6004.                 reset new_tkt.flags.INVALID;
  6005.         endif
  6006.  
  6007.         if (req.kdc-options.(any flag except ENC-TKT-IN-SKEY, RENEW,
  6008.                              and those already processed) is set) then
  6009.                 error_out(KDC_ERR_BADOPTION);
  6010.         endif
  6011.  
  6012.         new_tkt.authtime := tgt.authtime;
  6013.  
  6014.         if (req.kdc-options.RENEW is set) then
  6015.           /* Note that if the endtime has already passed, the ticket would  */
  6016.           /* have been rejected in the initial authentication stage, so     */
  6017.           /* there is no need to check again here                           */
  6018.                 if (tgt.flags.RENEWABLE is reset) then
  6019.                         error_out(KDC_ERR_BADOPTION);
  6020.                 endif
  6021.                 if (tgt.renew-till >= kdc_time) then
  6022.                         error_out(KRB_AP_ERR_TKT_EXPIRED);
  6023.                 endif
  6024.                 tkt := tgt;
  6025.                 new_tkt.starttime := kdc_time;
  6026.                 old_life := tgt.endttime - tgt.starttime;
  6027.                 new_tkt.endtime := min(tgt.renew-till,
  6028.                                        new_tkt.starttime + old_life);
  6029.         else
  6030.                 new_tkt.starttime := kdc_time;
  6031.                 if (req.till = 0) then
  6032.                         till := infinity;
  6033.                 else
  6034.                         till := req.till;
  6035.                 endif
  6036.                 new_tkt.endtime := min(till,
  6037.                                        new_tkt.starttime+client.max_life,
  6038.                                        new_tkt.starttime+server.max_life,
  6039.                                        new_tkt.starttime+max_life_for_realm,
  6040.                                        tgt.endtime);
  6041.  
  6042.                 if ((req.kdc-options.RENEWABLE-OK is set) and
  6043.                     (new_tkt.endtime < req.till) and
  6044.                     (tgt.flags.RENEWABLE is set) then
  6045.                         /* we set the RENEWABLE option for later processing */
  6046.                         set req.kdc-options.RENEWABLE;
  6047.                         req.rtime := min(req.till, tgt.renew-till);
  6048.                 endif
  6049.         endif
  6050.  
  6051.         if (req.rtime = 0) then
  6052.  
  6053.  
  6054. Section A.6.               - 92 -   Expires 28 February 1993
  6055.  
  6056.  
  6057.  
  6058.  
  6059.  
  6060.  
  6061.                   Version 5 - Revision 5.1
  6062.  
  6063.  
  6064.                 rtime := infinity;
  6065.         else
  6066.                 rtime := req.rtime;
  6067.         endif
  6068.  
  6069.         if ((req.kdc-options.RENEWABLE is set) and
  6070.             (tgt.flags.RENEWABLE is set)) then
  6071.                 set new_tkt.flags.RENEWABLE;
  6072.                 new_tkt.renew-till := min(rtime,
  6073.                                           new_tkt.starttime+client.max_rlife,
  6074.                                           new_tkt.starttime+server.max_rlife,
  6075.                                           new_tkt.starttime+max_rlife_for_realm,
  6076.                                           tgt.renew-till);
  6077.         else
  6078.                 new_tkt.renew-till := OMIT; /* leave the renew-till field out */
  6079.         endif
  6080.         if (req.enc-authorization-data is present) then
  6081.                 decrypt req.enc-authorization-data into decrypted_authorization_data
  6082.                         using auth_hdr.authenticator.subkey;
  6083.                 if (decrypt_error()) then
  6084.                         error_out(KRB_AP_ERR_BAD_INTEGRITY);
  6085.                 endif
  6086.         endif
  6087.         new_tkt.authorization_data := req.auth_hdr.ticket.authorization_data +
  6088.                                  decrypted_authorization_data;
  6089.  
  6090.         new_tkt.key := session;
  6091.         new_tkt.crealm := tgt.crealm;
  6092.         new_tkt.cname := req.auth_hdr.ticket.cname;
  6093.  
  6094.         if (realm_tgt_is_for(tgt) := tgt.realm) then
  6095.                 /* tgt issued by local realm */
  6096.                 new_tkt.transited := tgt.transited;
  6097.         else
  6098.                 /* was issued for this realm by some other realm */
  6099.                 if (tgt.transited.tr-type not supported) then
  6100.                         error_out(KDC_ERR_TRTYPE_NOSUPP);
  6101.                 endif
  6102.                 new_tkt.transited := compress_transited(tgt.transited + tgt.realm)
  6103.         endif
  6104.  
  6105.         encode encrypted part of new_tkt into OCTET STRING;
  6106.         if (req.kdc-options.ENC-TKT-IN-SKEY is set) then
  6107.                 if (req.second_ticket is not a TGT) then
  6108.                         error_out(KDC_ERR_POLICY);
  6109.                 endif
  6110.  
  6111.                 new_tkt.enc-part := encrypt OCTET STRING using
  6112.                         using etype_for_key(second-ticket.key), second-ticket.key;
  6113.      else
  6114.                 new_tkt.enc-part := encrypt OCTET STRING
  6115.                         using etype_for_key(server.key), server.key, server.p_kvno;
  6116.         endif
  6117.  
  6118.  
  6119.  
  6120. Section A.6.               - 93 -   Expires 28 February 1993
  6121.  
  6122.  
  6123.  
  6124.  
  6125.  
  6126.  
  6127.                   Version 5 - Revision 5.1
  6128.  
  6129.  
  6130.         resp.pvno := 5;
  6131.         resp.msg-type := KRB_TGS_REP;
  6132.         resp.crealm := tgt.crealm;
  6133.         resp.cname := tgt.cname;
  6134.  
  6135.         resp.ticket := new_tkt;
  6136.  
  6137.         resp.key := session;
  6138.         resp.nonce := req.nonce;
  6139.         resp.last-req := fetch_last_request_info(client);
  6140.         resp.flags := new_tkt.flags;
  6141.  
  6142.         resp.authtime := new_tkt.authtime;
  6143.         resp.starttime := new_tkt.starttime;
  6144.         resp.endtime := new_tkt.endtime;
  6145.  
  6146.         omit resp.key-expiration;
  6147.  
  6148.         resp.sname := new_tkt.sname;
  6149.         resp.realm := new_tkt.realm;
  6150.  
  6151.         if (new_tkt.flags.RENEWABLE) then
  6152.                 resp.renew-till := new_tkt.renew-till;
  6153.         endif
  6154.  
  6155.  
  6156.         encode body of reply into OCTET STRING;
  6157.  
  6158.      if (req.padata.authenticator.subkey)
  6159.              resp.enc-part := encrypt OCTET STRING using use_etype,
  6160.                req.padata.authenticator.subkey;
  6161.      else resp.enc-part := encrypt OCTET STRING using use_etype, tgt.key;
  6162.  
  6163.         send(resp);
  6164.  
  6165. A.7.  KRB_TGS_REP verification
  6166.         decode response into resp;
  6167.  
  6168.         if (resp.msg-type = KRB_ERROR) then
  6169.                 process_error(resp);
  6170.                 return;
  6171.         endif
  6172.  
  6173.         /* On error, discard the response, and zero the session key from
  6174.         the response immediately */
  6175.  
  6176.      if (req.padata.authenticator.subkey)
  6177.           unencrypted part of resp := decode of decrypt of resp.enc-part
  6178.                     using resp.enc-part.etype and subkey;
  6179.      else unencrypted part of resp := decode of decrypt of resp.enc-part
  6180.                                 using resp.enc-part.etype and tgt's session key;
  6181.         if (common_as_rep_tgs_rep_checks fail) then
  6182.                 destroy resp.key;
  6183.                 return error;
  6184.  
  6185.  
  6186. Section A.7.               - 94 -   Expires 28 February 1993
  6187.  
  6188.  
  6189.  
  6190.  
  6191.  
  6192.  
  6193.                   Version 5 - Revision 5.1
  6194.  
  6195.  
  6196.         endif
  6197.  
  6198.         check authorization_data as necessary;
  6199.         save_for_later(ticket,session,client,server,times,flags);
  6200.  
  6201. A.8.  Authenticator generation
  6202.         body.authenticator-vno := authenticator vno; /* = 5 */
  6203.         body.cname, body.crealm := client name;
  6204.         if (supplying checksum) then
  6205.                 body.cksum := checksum;
  6206.         endif
  6207.         get system_time;
  6208.         body.ctime, body.cusec := system_time;
  6209.         if (selecting sub-session key) then
  6210.                 select sub-session key;
  6211.                 body.subkey := sub-session key;
  6212.         endif
  6213.         if (using sequence numbers) then
  6214.                 select initial sequence number;
  6215.                 body.seq-number := initial sequence;
  6216.         endif
  6217.  
  6218. A.9.  KRB_AP_REQ generation
  6219.         obtain ticket and session_key from cache;
  6220.  
  6221.         packet.pvno := protocol version; /* 5 */
  6222.         packet.msg-type := message type; /* KRB_AP_REQ */
  6223.  
  6224.         if (desired(MUTUAL_AUTHENTICATION)) then
  6225.                 set packet.ap-options.MUTUAL-REQUIRED;
  6226.         else
  6227.                 reset packet.ap-options.MUTUAL-REQUIRED;
  6228.         endif
  6229.         if (using session key for ticket) then
  6230.                 set packet.ap-options.USE-SESSION-KEY;
  6231.         else
  6232.                 reset packet.ap-options.USE-SESSION-KEY;
  6233.         endif
  6234.         packet.ticket := ticket; /* ticket */
  6235.         generate authenticator;
  6236.         encode authenticator into OCTET STRING;
  6237.         encrypt OCTET STRING into packet.authenticator using session_key;
  6238.  
  6239. A.10.  KRB_AP_REQ verification
  6240.         receive packet;
  6241.         if (packet.pvno != 5) then
  6242.                 either process using other protocol spec
  6243.                 or error_out(KRB_AP_ERR_BADVERSION);
  6244.         endif
  6245.         if (packet.msg-type != KRB_AP_REQ) then
  6246.                 error_out(KRB_AP_ERR_MSG_TYPE);
  6247.         endif
  6248.         if (packet.ticket.tkt_vno != 5) then
  6249.                 either process using other protocol spec
  6250.  
  6251.  
  6252. Section A.10.              - 95 -   Expires 28 February 1993
  6253.  
  6254.  
  6255.  
  6256.  
  6257.  
  6258.  
  6259.                   Version 5 - Revision 5.1
  6260.  
  6261.  
  6262.                 or error_out(KRB_AP_ERR_BADVERSION);
  6263.         endif
  6264.         if (packet.ap_options.USE-SESSION-KEY is set) then
  6265.                 retrieve session key from ticket-granting ticket for
  6266.                  packet.ticket.{sname,srealm,enc-part.etype};
  6267.         else
  6268.                 retrieve service key for
  6269.                  packet.ticket.{sname,srealm,enc-part.etype,enc-part.skvno};
  6270.         endif
  6271.         if (no_key_available) then
  6272.                 if (cannot_find_specified_skvno) then
  6273.                         error_out(KRB_AP_ERR_BADKEYVER);
  6274.                 else
  6275.                         error_out(KRB_AP_ERR_NOKEY);
  6276.                 endif
  6277.         endif
  6278.         decrypt packet.ticket.enc-part into decr_ticket using retrieved key;
  6279.         if (decryption_error()) then
  6280.                 error_out(KRB_AP_ERR_BAD_INTEGRITY);
  6281.         endif
  6282.         decrypt packet.authenticator into decr_authenticator
  6283.                 using decr_ticket.key;
  6284.         if (decryption_error()) then
  6285.                 error_out(KRB_AP_ERR_BAD_INTEGRITY);
  6286.         endif
  6287.         if (decr_authenticator.{cname,crealm} !=
  6288.             decr_ticket.{cname,crealm}) then
  6289.                 error_out(KRB_AP_ERR_BADMATCH);
  6290.         endif
  6291.         if (decr_ticket.caddr is present) then
  6292.                 if (sender_address(packet) is not in decr_ticket.caddr) then
  6293.                         error_out(KRB_AP_ERR_BADADDR);
  6294.                 endif
  6295.         elseif (application requires addresses) then
  6296.                 error_out(KRB_AP_ERR_BADADDR);
  6297.         endif
  6298.         if (not in_clock_skew(decr_authenticator.ctime,
  6299.                               decr_authenticator.cusec)) then
  6300.                 error_out(KRB_AP_ERR_SKEW);
  6301.         endif
  6302.         if (repeated(decr_authenticator.{ctime,cusec,cname,crealm})) then
  6303.                 error_out(KRB_AP_ERR_REPEAT);
  6304.         endif
  6305.         save_identifier(decr_authenticator.{ctime,cusec,cname,crealm});
  6306.         get system_time;
  6307.         if ((decr_ticket.starttime-system_time > CLOCK_SKEW) or
  6308.             (decr_ticket.flags.INVALID is set)) then
  6309.                 /* it hasn't yet become valid */
  6310.                 error_out(KRB_AP_ERR_TKT_NYV);
  6311.         endif
  6312.         if (system_time-decr_ticket.endtime > CLOCK_SKEW) then
  6313.                 error_out(KRB_AP_ERR_TKT_EXPIRED);
  6314.         endif
  6315.         /* caller must check decr_ticket.flags for any pertinent details */
  6316.  
  6317.  
  6318. Section A.10.              - 96 -   Expires 28 February 1993
  6319.  
  6320.  
  6321.  
  6322.  
  6323.  
  6324.  
  6325.                   Version 5 - Revision 5.1
  6326.  
  6327.  
  6328.         return(OK, decr_ticket, packet.ap_options.MUTUAL-REQUIRED);
  6329.  
  6330. A.11.  KRB_AP_REP generation
  6331.         packet.pvno := protocol version; /* 5 */
  6332.         packet.msg-type := message type; /* KRB_AP_REP */
  6333.  
  6334.         body.ctime := packet.ctime;
  6335.         body.cusec := packet.cusec;
  6336.         if (selecting sub-session key) then
  6337.                 select sub-session key;
  6338.                 body.subkey := sub-session key;
  6339.         endif
  6340.         if (using sequence numbers) then
  6341.                 select initial sequence number;
  6342.                 body.seq-number := initial sequence;
  6343.         endif
  6344.  
  6345.         encode body into OCTET STRING;
  6346.  
  6347.         select encryption type;
  6348.         encrypt OCTET STRING into packet.enc-part;
  6349.  
  6350. A.12.  KRB_AP_REP verification
  6351.         receive packet;
  6352.         if (packet.pvno != 5) then
  6353.                 either process using other protocol spec
  6354.                 or error_out(KRB_AP_ERR_BADVERSION);
  6355.         endif
  6356.         if (packet.msg-type != KRB_AP_REP) then
  6357.                 error_out(KRB_AP_ERR_MSG_TYPE);
  6358.         endif
  6359.         cleartext := decrypt(packet.enc-part) using ticket's session key;
  6360.         if (decryption_error()) then
  6361.                 error_out(KRB_AP_ERR_BAD_INTEGRITY);
  6362.         endif
  6363.         if (cleartext.ctime != authenticator.ctime) then
  6364.                 error_out(KRB_AP_ERR_MUT_FAIL);
  6365.         endif
  6366.         if (cleartext.cusec != authenticator.cusec) then
  6367.                 error_out(KRB_AP_ERR_MUT_FAIL);
  6368.         endif
  6369.         if (cleartext.subkey is present) then
  6370.                 save cleartext.subkey for future use;
  6371.         endif
  6372.         if (cleartext.seq-number is present) then
  6373.                 save cleartext.seq-number for future verifications;
  6374.         endif
  6375.         return(AUTHENTICATION_SUCCEEDED);
  6376.  
  6377. A.13.  KRB_SAFE generation
  6378.         collect user data in buffer;
  6379.  
  6380.         /* assemble packet: */
  6381.         packet.pvno := protocol version; /* 5 */
  6382.  
  6383.  
  6384. Section A.13.              - 97 -   Expires 28 February 1993
  6385.  
  6386.  
  6387.  
  6388.  
  6389.  
  6390.  
  6391.                   Version 5 - Revision 5.1
  6392.  
  6393.  
  6394.         packet.msg-type := message type; /* KRB_SAFE */
  6395.  
  6396.         body.user-data := buffer; /* DATA */
  6397.         if (using timestamp) then
  6398.                 get system_time;
  6399.                 body.timestamp, body.usec := system_time;
  6400.         endif
  6401.         if (using sequence numbers) then
  6402.                 body.seq-number := sequence number;
  6403.         endif
  6404.         body.s-address := sender host addresses;
  6405.         if (only one recipient) then
  6406.                 body.r-address := recipient host address;
  6407.         endif
  6408.         checksum.cksumtype := checksum type;
  6409.         compute checksum over body;
  6410.         checksum.checksum := checksum value; /* checksum.checksum */
  6411.         packet.cksum := checksum;
  6412.         packet.safe-body := body;
  6413.  
  6414. A.14.  KRB_SAFE verification
  6415.         receive packet;
  6416.         if (packet.pvno != 5) then
  6417.                 either process using other protocol spec
  6418.                 or error_out(KRB_AP_ERR_BADVERSION);
  6419.         endif
  6420.         if (packet.msg-type != KRB_SAFE) then
  6421.                 error_out(KRB_AP_ERR_MSG_TYPE);
  6422.         endif
  6423.         if (packet.checksum.cksumtype is not both collision-proof and keyed) then
  6424.                 error_out(KRB_AP_ERR_INAPP_CKSUM);
  6425.         endif
  6426.         if (safe_priv_common_checks_ok(packet)) then
  6427.                 set computed_checksum := checksum(packet.body);
  6428.                 if (computed_checksum != packet.checksum) then
  6429.                         error_out(KRB_AP_ERR_MODIFIED);
  6430.                 endif
  6431.                 return (packet, PACKET_IS_GENUINE);
  6432.         else
  6433.                 return common_checks_error;
  6434.         endif
  6435.  
  6436. A.15.  KRB_SAFE and KRB_PRIV common checks
  6437.         if (packet.s-address != O/S_sender(packet)) then
  6438.                 /* O/S report of sender not who claims to have sent it */
  6439.                 error_out(KRB_AP_ERR_BADADDR);
  6440.         endif
  6441.         if ((packet.r-address is present) and
  6442.             (packet.r-address != local_host_address)) then
  6443.                 /* was not sent to proper place */
  6444.                 error_out(KRB_AP_ERR_BADADDR);
  6445.         endif
  6446.         if (((packet.timestamp is present) and
  6447.              (not in_clock_skew(packet.timestamp,packet.usec))) or
  6448.  
  6449.  
  6450. Section A.15.              - 98 -   Expires 28 February 1993
  6451.  
  6452.  
  6453.  
  6454.  
  6455.  
  6456.  
  6457.                   Version 5 - Revision 5.1
  6458.  
  6459.  
  6460.             (packet.timestamp is not present and timestamp expected)) then
  6461.                 error_out(KRB_AP_ERR_SKEW);
  6462.         endif
  6463.         if (repeated(packet.timestamp,packet.usec,packet.s-address)) then
  6464.                 error_out(KRB_AP_ERR_REPEAT);
  6465.         endif
  6466.         if (((packet.seq-number is present) and
  6467.              ((not in_sequence(packet.seq-number)))) or
  6468.             (packet.seq-number is not present and sequence expected)) then
  6469.                 error_out(KRB_AP_ERR_BADORDER);
  6470.         endif
  6471.         if (packet.timestamp not present and packet.seq-number not present) then
  6472.                 error_out(KRB_AP_ERR_MODIFIED);
  6473.         endif
  6474.  
  6475.         save_identifier(packet.{timestamp,usec,s-address},
  6476.                         sender_principal(packet));
  6477.  
  6478.         return PACKET_IS_OK;
  6479.  
  6480. A.16.  KRB_PRIV generation
  6481.         collect user data in buffer;
  6482.  
  6483.         /* assemble packet: */
  6484.         packet.pvno := protocol version; /* 5 */
  6485.         packet.msg-type := message type; /* KRB_PRIV */
  6486.  
  6487.         packet.enc-part.etype := encryption type;
  6488.  
  6489.         body.user-data := buffer;
  6490.         if (using timestamp) then
  6491.                 get system_time;
  6492.                 body.timestamp, body.usec := system_time;
  6493.         endif
  6494.         if (using sequence numbers) then
  6495.                 body.seq-number := sequence number;
  6496.         endif
  6497.         body.s-address := sender host addresses;
  6498.         if (only one recipient) then
  6499.                 body.r-address := recipient host address;
  6500.         endif
  6501.  
  6502.         encode body into OCTET STRING;
  6503.  
  6504.         select encryption type;
  6505.         encrypt OCTET STRING into packet.enc-part.cipher;
  6506.  
  6507.  
  6508. A.17.  KRB_PRIV verification
  6509.         receive packet;
  6510.         if (packet.pvno != 5) then
  6511.                 either process using other protocol spec
  6512.                 or error_out(KRB_AP_ERR_BADVERSION);
  6513.         endif
  6514.  
  6515.  
  6516. Section A.17.              - 99 -   Expires 28 February 1993
  6517.  
  6518.  
  6519.  
  6520.  
  6521.  
  6522.  
  6523.                   Version 5 - Revision 5.1
  6524.  
  6525.  
  6526.         if (packet.msg-type != KRB_PRIV) then
  6527.                 error_out(KRB_AP_ERR_MSG_TYPE);
  6528.         endif
  6529.  
  6530.         cleartext := decrypt(packet.enc-part) using negotiated key;
  6531.         if (decryption_error()) then
  6532.                 error_out(KRB_AP_ERR_BAD_INTEGRITY);
  6533.         endif
  6534.  
  6535.         if (safe_priv_common_checks_ok(cleartext)) then
  6536.                 return(cleartext.DATA, PACKET_IS_GENUINE_AND_UNMODIFIED);
  6537.         else
  6538.                 return common_checks_error;
  6539.         endif
  6540.  
  6541. A.18.  KRB_ERROR generation
  6542.  
  6543.         /* assemble packet: */
  6544.         packet.pvno := protocol version; /* 5 */
  6545.         packet.msg-type := message type; /* KRB_ERROR */
  6546.  
  6547.         get system_time;
  6548.         packet.stime, packet.susec := system_time;
  6549.         packet.realm, packet.sname := server name;
  6550.  
  6551.         if (client time available) then
  6552.                 packet.ctime, packet.cusec := client_time;
  6553.         endif
  6554.         packet.error-code := error code;
  6555.         if (client name available) then
  6556.                 packet.cname, packet.crealm := client name;
  6557.         endif
  6558.         if (error text available) then
  6559.                 packet.e-text := error text;
  6560.         endif
  6561.         if (error data available) then
  6562.                 packet.e-data := error data;
  6563.         endif
  6564.  
  6565.  
  6566.  
  6567.  
  6568.  
  6569.  
  6570.  
  6571.  
  6572.  
  6573.  
  6574.  
  6575.  
  6576.  
  6577.  
  6578.  
  6579.  
  6580.  
  6581.  
  6582.                            - c -    Expires 28 February 1993
  6583.  
  6584.  
  6585.  
  6586.  
  6587.  
  6588.  
  6589.  
  6590.  
  6591.  
  6592.  
  6593.  
  6594.  
  6595.                      Table of Contents
  6596.  
  6597.  
  6598.  
  6599.  
  6600. Overview ..............................................    1
  6601.  
  6602. Background ............................................    2
  6603.  
  6604. 1. Introduction .......................................    2
  6605.  
  6606. 1.1. Cross-Realm Operation ............................    4
  6607.  
  6608. 1.2. Environmental assumptions ........................    5
  6609.  
  6610. 1.3. Glossary of terms ................................    6
  6611.  
  6612. 2. Ticket flag uses and requests ......................    9
  6613.  
  6614. 2.1. Initial and pre-authenticated tickets ............    9
  6615.  
  6616. 2.2. Invalid tickets ..................................    9
  6617.  
  6618. 2.3. Renewable tickets ................................    9
  6619.  
  6620. 2.4. Postdated tickets ................................   10
  6621.  
  6622. 2.5. Proxiable and proxy tickets ......................   11
  6623.  
  6624. 2.6. Forwardable tickets ..............................   12
  6625.  
  6626. 2.7. Other KDC options ................................   12
  6627.  
  6628. 3. Message Exchanges ..................................   13
  6629.  
  6630. 3.1. The Authentication Service Exchange ..............   13
  6631.  
  6632. 3.1.1. Generation of KRB_AS_REQ message ...............   14
  6633.  
  6634. 3.1.2. Receipt of KRB_AS_REQ message ..................   14
  6635.  
  6636. 3.1.3. Generation of KRB_AS_REP message ...............   14
  6637.  
  6638. 3.1.4. Generation of KRB_ERROR message ................   16
  6639.  
  6640. 3.1.5. Receipt of KRB_AS_REP message ..................   16
  6641.  
  6642. 3.1.6. Receipt of KRB_ERROR message ...................   17
  6643.  
  6644. 3.2. The Client/Server Authentication Exchange ........   17
  6645.  
  6646.  
  6647.  
  6648.                            - i -    Expires 28 February 1993
  6649.  
  6650.  
  6651.  
  6652.  
  6653.  
  6654.  
  6655.                   Version 5 - Revision 5.1
  6656.  
  6657.  
  6658. 3.2.1. The KRB_AP_REQ message .........................   17
  6659.  
  6660. 3.2.2. Generation of a KRB_AP_REQ message .............   18
  6661.  
  6662. 3.2.3. Receipt of KRB_AP_REQ message ..................   18
  6663.  
  6664. 3.2.4. Generation of a KRB_AP_REP message .............   20
  6665.  
  6666. 3.2.5. Receipt of KRB_AP_REP message ..................   21
  6667.  
  6668. 3.2.6. Using the encryption key .......................   21
  6669.  
  6670. 3.3. The Ticket-Granting Service (TGS) Exchange .......   22
  6671.  
  6672. 3.3.1. Generation of KRB_TGS_REQ message ..............   23
  6673.  
  6674. 3.3.2. Receipt of KRB_TGS_REQ message .................   24
  6675.  
  6676. 3.3.3. Generation of KRB_TGS_REP message ..............   25
  6677.  
  6678. 3.3.3.1. Encoding the transited field .................   27
  6679.  
  6680. 3.3.4. Receipt of KRB_TGS_REP message .................   29
  6681.  
  6682. 3.4. The KRB_SAFE Exchange ............................   29
  6683.  
  6684. 3.4.1. Generation of a KRB_SAFE message ...............   29
  6685.  
  6686. 3.4.2. Receipt of KRB_SAFE message ....................   30
  6687.  
  6688. 3.5. The KRB_PRIV Exchange ............................   30
  6689.  
  6690. 3.5.1. Generation of a KRB_PRIV message ...............   31
  6691.  
  6692. 3.5.2. Receipt of KRB_PRIV message ....................   31
  6693.  
  6694. 4. The Kerberos Database ..............................   32
  6695.  
  6696. 4.1. Database contents ................................   32
  6697.  
  6698. 4.2. Additional fields ................................   33
  6699.  
  6700. 4.3. Frequently Changing Fields .......................   34
  6701.  
  6702. 4.4. Site Constants ...................................   34
  6703.  
  6704. 5. Message Specifications .............................   35
  6705.  
  6706. 5.1. ASN.1 Distinguished Encoding Representation ......   35
  6707.  
  6708. 5.2. ASN.1 Base Definitions ...........................   35
  6709.  
  6710. 5.3. Tickets and Authenticators .......................   38
  6711.  
  6712.  
  6713.  
  6714.                            - ii -   Expires 28 February 1993
  6715.  
  6716.  
  6717.  
  6718.  
  6719.  
  6720.  
  6721.                   Version 5 - Revision 5.1
  6722.  
  6723.  
  6724. 5.3.1. Tickets ........................................   38
  6725.  
  6726. 5.3.2. Authenticators .................................   44
  6727.  
  6728. 5.4. Specifications for the AS and TGS exchanges ......   45
  6729.  
  6730. 5.4.1. KRB_KDC_REQ definition .........................   45
  6731.  
  6732. 5.4.2. KRB_KDC_REP definition .........................   52
  6733.  
  6734. 5.5. Client/Server (CS) message specifications ........   55
  6735.  
  6736. 5.5.1. KRB_AP_REQ definition ..........................   55
  6737.  
  6738. 5.5.2. KRB_AP_REP definition ..........................   56
  6739.  
  6740. 5.5.3. Error message reply ............................   57
  6741.  
  6742. 5.6. KRB_SAFE message specification ...................   57
  6743.  
  6744. 5.6.1. KRB_SAFE definition ............................   57
  6745.  
  6746. 5.7. KRB_PRIV message specification ...................   59
  6747.  
  6748. 5.7.1. KRB_PRIV definition ............................   59
  6749.  
  6750. 5.8. Error message specification ......................   60
  6751.  
  6752. 5.8.1. KRB_ERROR definition ...........................   60
  6753.  
  6754. 6. Encryption and Checksum Specifications .............   62
  6755.  
  6756. 6.1. Encryption Specifications ........................   63
  6757.  
  6758. 6.2. Encryption Keys ..................................   65
  6759.  
  6760. 6.3. Encryption Systems ...............................   66
  6761.  
  6762. 6.3.1. The NULL Encryption System (null) ..............   66
  6763.  
  6764. 6.3.2. DES in CBC mode with a CRC-32 checksum (des-
  6765. cbc-crc) ..............................................   66
  6766.  
  6767. 6.3.3. DES in CBC mode with an MD4 checksum (des-
  6768. cbc-md4) ..............................................   67
  6769.  
  6770. 6.3.4. DES in CBC mode with an MD5 checksum (des-
  6771. cbc-md5) ..............................................   67
  6772.  
  6773. 6.4. Checksums ........................................   68
  6774.  
  6775. 6.4.1. The CRC-32 Checksum (crc32) ....................   69
  6776.  
  6777. 6.4.2. The RSA MD4 Checksum (rsa-md4) .................   69
  6778.  
  6779.  
  6780.                           - iii -   Expires 28 February 1993
  6781.  
  6782.  
  6783.  
  6784.  
  6785.  
  6786.  
  6787.                   Version 5 - Revision 5.1
  6788.  
  6789.  
  6790. 6.4.3. RSA MD4 Cryptographic Checksum Using DES
  6791. (rsa-md4-des) .........................................   70
  6792.  
  6793. 6.4.4. The RSA MD5 Checksum (rsa-md5) .................   71
  6794.  
  6795. 6.4.5. RSA MD5 Cryptographic Checksum Using DES
  6796. (rsa-md5-des) .........................................   71
  6797.  
  6798. 6.4.6. DES cipher-block chained checksum (des-mac)
  6799.  
  6800. 6.4.7. RSA MD4 Cryptographic Checksum Using DES
  6801. alternative (rsa-md4-des-k) ...........................   72
  6802.  
  6803. 6.4.8. DES cipher-block chained checksum alternative
  6804. (des-mac-k) ...........................................   72
  6805.  
  6806. 7. Naming Constraints .................................   73
  6807.  
  6808. 7.1. Realm Names ......................................   73
  6809.  
  6810. 7.2. Principal Names ..................................   74
  6811.  
  6812. 8. Constants and other defined values .................   75
  6813.  
  6814. 8.1. Host address types ...............................   75
  6815.  
  6816. 8.2. KDC messages .....................................   76
  6817.  
  6818. 8.2.1. IP transport ...................................   76
  6819.  
  6820. 8.2.2. OSI transport ..................................   76
  6821.  
  6822. 8.2.3. Name of the TGS ................................   77
  6823.  
  6824. 8.3. Protocol constants and associated values .........   77
  6825.  
  6826. 9. Interoperability requirements ......................   79
  6827.  
  6828. 9.1. Specification 1 ..................................   80
  6829.  
  6830. 9.2. Recommended KDC values ...........................   81
  6831.  
  6832. 10. Acknowledgments ...................................   81
  6833.  
  6834. 11. REFERENCES ........................................   82
  6835.  
  6836. A. Pseudo-code for protocol processing ................   84
  6837.  
  6838. A.1. KRB_AS_REQ generation ............................   84
  6839.  
  6840. A.2. KRB_AS_REQ verification and KRB_AS_REP genera-
  6841. tion ..................................................   84
  6842.  
  6843. A.3. KRB_AS_REP verification ..........................   87
  6844.  
  6845.  
  6846.                            - iv -   Expires 28 February 1993
  6847.  
  6848.  
  6849.  
  6850.  
  6851.  
  6852.  
  6853.                   Version 5 - Revision 5.1
  6854.  
  6855.  
  6856. A.4. KRB_AS_REP and KRB_TGS_REP common checks .........   88
  6857.  
  6858. A.5. KRB_TGS_REQ generation ...........................   88
  6859.  
  6860. A.6. KRB_TGS_REQ verification and KRB_TGS_REP gen-
  6861. eration ...............................................   89
  6862.  
  6863. A.7. KRB_TGS_REP verification .........................   94
  6864.  
  6865. A.8. Authenticator generation .........................   95
  6866.  
  6867. A.9. KRB_AP_REQ generation ............................   95
  6868.  
  6869. A.10. KRB_AP_REQ verification .........................   95
  6870.  
  6871. A.11. KRB_AP_REP generation ...........................   97
  6872.  
  6873. A.12. KRB_AP_REP verification .........................   97
  6874.  
  6875. A.13. KRB_SAFE generation .............................   97
  6876.  
  6877. A.14. KRB_SAFE verification ...........................   98
  6878.  
  6879. A.15. KRB_SAFE and KRB_PRIV common checks .............   98
  6880.  
  6881. A.16. KRB_PRIV generation .............................   99
  6882.  
  6883. A.17. KRB_PRIV verification ...........................   99
  6884.  
  6885. A.18. KRB_ERROR generation ............................  100
  6886.  
  6887.  
  6888.  
  6889.  
  6890.  
  6891.  
  6892.  
  6893.  
  6894.  
  6895.  
  6896.  
  6897.  
  6898.  
  6899.  
  6900.  
  6901.  
  6902.  
  6903.  
  6904.  
  6905.  
  6906.  
  6907.  
  6908.  
  6909.  
  6910.  
  6911.  
  6912.                            - v -    Expires 28 February 1993
  6913.  
  6914.  
  6915.  
  6916.  
  6917. A.  Pseudo-code for protocol processing
  6918.  
  6919.      This appendix provides pseudo-code describing  how  the
  6920. messages  are  to  be constructed and interpreted by clients
  6921. and servers.
  6922.  
  6923. A.1.  KRB_AS_REQ generation
  6924.         request.pvno := protocol version; /* pvno = 5 */
  6925.         request.msg-type := message type; /* type = KRB_AS_REQ */
  6926.  
  6927.         body.kdc-options := users's preferences;
  6928.         body.cname := user's name;
  6929.         body.realm := user's realm;
  6930.         body.sname := service's name; /* usually "krbtgt",  "localrealm" */
  6931.         if (body.kdc-options.POSTDATED is set) then
  6932.                 body.from := requested starting time;
  6933.         else
  6934.                 omit body.from;
  6935.         endif
  6936.         body.till := requested end time;
  6937.         if (body.kdc-options.RENEWABLE is set) then
  6938.                 body.rtime := requested final renewal time;
  6939.         endif
  6940.         body.nonce := random_nonce();
  6941.         body.etype := requested etypes;
  6942.         if (user supplied addresses) then
  6943.                 body.addresses := user's addresses;
  6944.         else
  6945.                 omit body.addresses;
  6946.         endif
  6947.         omit body.enc-authorization-data;
  6948.         request.req-body := body;
  6949.  
  6950.         kerberos := lookup(name of local kerberos server (or servers));
  6951.         send(packet,kerberos);
  6952.  
  6953.         wait(for response);
  6954.         if (timed_out) then
  6955.                 retry or use alternate server;
  6956.         endif
  6957.  
  6958. A.2.  KRB_AS_REQ verification and KRB_AS_REP generation
  6959.         decode message into req;
  6960.  
  6961.         client := lookup(req.cname,req.realm);
  6962.         server := lookup(req.sname,req.realm);
  6963.  
  6964.         get system_time;
  6965.         kdc_time := system_time.seconds;
  6966.  
  6967.         if (!client) then
  6968.                 /* no client in Database */
  6969.                 error_out(KDC_ERR_C_PRINCIPAL_UNKNOWN);
  6970.         endif
  6971.  
  6972.  
  6973. Section A.2.               - 84 -   Expires 28 February 1993
  6974.  
  6975.  
  6976.  
  6977.  
  6978.  
  6979.  
  6980.                   Version 5 - Revision 5.1
  6981.  
  6982.  
  6983.         if (!server) then
  6984.                 /* no server in Database */
  6985.                 error_out(KDC_ERR_S_PRINCIPAL_UNKNOWN);
  6986.         endif
  6987.  
  6988.         use_etype := first supported etype in req.etypes;
  6989.  
  6990.         if (no support for req.etypes) then
  6991.                 error_out(KDC_ERR_ETYPE_NOSUPP);
  6992.         endif
  6993.  
  6994.         new_tkt.vno := ticket version; /* = 5 */
  6995.         new_tkt.sname := req.sname;
  6996.         new_tkt.srealm := req.srealm;
  6997.         reset all flags in new_tkt.flags;
  6998.  
  6999.         /* It should be noted that local policy may affect the  */
  7000.         /* processing of any of these flags.  For example, some */
  7001.         /* realms may refuse to issue renewable tickets         */
  7002.  
  7003.         if (req.kdc-options.FORWARDABLE is set) then
  7004.                 set new_tkt.flags.FORWARDABLE;
  7005.         endif
  7006.         if (req.kdc-options.PROXIABLE is set) then
  7007.                 set new_tkt.flags.PROXIABLE;
  7008.         endif
  7009.         if (req.kdc-options.ALLOW-POSTDATE is set) then
  7010.                 set new_tkt.flags.ALLOW-POSTDATE;
  7011.         endif
  7012.         if ((req.kdc-options.RENEW is set) or
  7013.             (req.kdc-options.VALIDATE is set) or
  7014.             (req.kdc-options.PROXY is set) or
  7015.             (req.kdc-options.FORWARDED is set) or
  7016.             (req.kdc-options.ENC-TKT-IN-SKEY is set)) then
  7017.                 error_out(KDC_ERR_BADOPTION);
  7018.         endif
  7019.  
  7020.         new_tkt.session := random_session_key();
  7021.         new_tkt.cname := req.cname;
  7022.         new_tkt.crealm := req.crealm;
  7023.         new_tkt.transited := empty_transited_field();
  7024.  
  7025.         new_tkt.authtime := kdc_time;
  7026.  
  7027.         if (req.kdc-options.POSTDATED is set) then
  7028.            if (against_postdate_policy(req.from)) then
  7029.                 error_out(KDC_ERR_POLICY);
  7030.            endif
  7031.            set new_tkt.flags.INVALID;
  7032.            new_tkt.starttime := req.from;
  7033.         else
  7034.            omit new_tkt.starttime; /* treated as authtime when omitted */
  7035.         endif
  7036.         if (req.till = 0) then
  7037.  
  7038.  
  7039. Section A.2.               - 85 -   Expires 28 February 1993
  7040.  
  7041.  
  7042.  
  7043.  
  7044.  
  7045.  
  7046.                   Version 5 - Revision 5.1
  7047.  
  7048.  
  7049.                 till := infinity;
  7050.         else
  7051.                 till := req.till;
  7052.         endif
  7053.  
  7054.         new_tkt.endtime := min(till,
  7055.                               new_tkt.starttime+client.max_life,
  7056.                               new_tkt.starttime+server.max_life,
  7057.                               new_tkt.starttime+max_life_for_realm);
  7058.  
  7059.         if ((req.kdc-options.RENEWABLE-OK is set) and
  7060.             (new_tkt.endtime < req.till)) then
  7061.                 /* we set the RENEWABLE option for later processing */
  7062.                 set req.kdc-options.RENEWABLE;
  7063.                 req.rtime := req.till;
  7064.         endif
  7065.  
  7066.         if (req.rtime = 0) then
  7067.                 rtime := infinity;
  7068.         else
  7069.                 rtime := req.rtime;
  7070.         endif
  7071.  
  7072.         if (req.kdc-options.RENEWABLE is set) then
  7073.                 set new_tkt.flags.RENEWABLE;
  7074.                 new_tkt.renew-till := min(rtime,
  7075.                                           new_tkt.starttime+client.max_rlife,
  7076.                                           new_tkt.starttime+server.max_rlife,
  7077.                                           new_tkt.starttime+max_rlife_for_realm);
  7078.         else
  7079.                 omit new_tkt.renew-till; /* only present if RENEWABLE */
  7080.         endif
  7081.  
  7082.         if (req.addresses) then
  7083.                 new_tkt.caddr := req.addresses;
  7084.         else
  7085.                 omit new_tkt.caddr;
  7086.         endif
  7087.  
  7088.         new_tkt.authorization_data := empty_authorization_data();
  7089.  
  7090.         encode to-be-encrypted part of ticket into OCTET STRING;
  7091.         new_tkt.enc-part := encrypt OCTET STRING
  7092.                 using etype_for_key(server.key), server.key, server.p_kvno;
  7093.  
  7094.  
  7095.         /* Start processing the response */
  7096.  
  7097.         resp.pvno := 5;
  7098.         resp.msg-type := KRB_AS_REP;
  7099.         resp.cname := req.cname;
  7100.         resp.crealm := req.realm;
  7101.         resp.ticket := new_tkt;
  7102.  
  7103.  
  7104.  
  7105. Section A.2.               - 86 -   Expires 28 February 1993
  7106.  
  7107.  
  7108.  
  7109.  
  7110.  
  7111.  
  7112.                   Version 5 - Revision 5.1
  7113.  
  7114.  
  7115.         resp.key := new_tkt.session;
  7116.         resp.last-req := fetch_last_request_info(client);
  7117.         resp.nonce := req.nonce;
  7118.         resp.key-expiration := client.expiration;
  7119.         resp.flags := new_tkt.flags;
  7120.  
  7121.         resp.authtime := new_tkt.authtime;
  7122.         resp.starttime := new_tkt.starttime;
  7123.         resp.endtime := new_tkt.endtime;
  7124.  
  7125.         if (new_tkt.flags.RENEWABLE) then
  7126.                 resp.renew-till := new_tkt.renew-till;
  7127.         endif
  7128.  
  7129.         resp.realm := new_tkt.realm;
  7130.         resp.sname := new_tkt.sname;
  7131.  
  7132.         resp.caddr := new_tkt.caddr;
  7133.  
  7134.         encode body of reply into OCTET STRING;
  7135.  
  7136.         resp.enc-part := encrypt OCTET STRING
  7137.                          using use_etype, client.key, client.p_kvno;
  7138.         send(resp);
  7139.  
  7140. A.3.  KRB_AS_REP verification
  7141.         decode response into resp;
  7142.  
  7143.         if (resp.msg-type = KRB_ERROR) then
  7144.                 process_error(resp);
  7145.                 return;
  7146.         endif
  7147.  
  7148.         /* On error, discard the response, and zero the session key */
  7149.         /* from the response immediately */
  7150.  
  7151.         key = get_decryption_key(resp.enc-part.kvno, resp.enc-part.etype,
  7152.                                  resp.padata);
  7153.         unencrypted part of resp := decode of decrypt of resp.enc-part
  7154.                                 using resp.enc-part.etype and key;
  7155.         zero(key);
  7156.  
  7157.         if (common_as_rep_tgs_rep_checks fail) then
  7158.                 destroy resp.key;
  7159.                 return error;
  7160.         endif
  7161.  
  7162.         if near(resp.princ_exp) then
  7163.                 print(warning message);
  7164.         endif
  7165.         save_for_later(ticket,session,client,server,times,flags);
  7166.  
  7167.  
  7168.  
  7169.  
  7170.  
  7171. Section A.3.               - 87 -   Expires 28 February 1993
  7172.  
  7173.  
  7174.  
  7175.  
  7176.  
  7177.  
  7178.                   Version 5 - Revision 5.1
  7179.  
  7180.  
  7181. A.4.  KRB_AS_REP and KRB_TGS_REP common checks
  7182.         if (decryption_error() or
  7183.             (req.cname != resp.cname) or
  7184.             (req.realm != resp.crealm) or
  7185.             (req.sname != resp.sname) or
  7186.             (req.realm != resp.realm) or
  7187.             (req.nonce != resp.nonce) or
  7188.             (req.addresses != resp.caddr)) then
  7189.                 destroy resp.key;
  7190.                 return KRB_AP_ERR_MODIFIED;
  7191.         endif
  7192.  
  7193.         /* make sure no flags are set that shouldn't be, and that all that */
  7194.         /* should be are set                                               */
  7195.         if (!check_flags_for_compatability(req.kdc-options,resp.flags)) then
  7196.                 destroy resp.key;
  7197.                 return KRB_AP_ERR_MODIFIED;
  7198.         endif
  7199.  
  7200.         if ((req.from = 0) and
  7201.             (resp.starttime is not within allowable skew)) then
  7202.                 destroy resp.key;
  7203.                 return KRB_AP_ERR_SKEW;
  7204.         endif
  7205.         if ((req.from != 0) and (req.from != resp.starttime)) then
  7206.                 destroy resp.key;
  7207.                 return KRB_AP_ERR_MODIFIED;
  7208.         endif
  7209.         if ((req.till != 0) and (resp.endtime > req.till)) then
  7210.                 destroy resp.key;
  7211.                 return KRB_AP_ERR_MODIFIED;
  7212.         endif
  7213.  
  7214.         if ((req.kdc-options.RENEWABLE is set) and
  7215.             (req.rtime != 0) and (resp.renew-till > req.rtime)) then
  7216.                 destroy resp.key;
  7217.                 return KRB_AP_ERR_MODIFIED;
  7218.         endif
  7219.         if ((req.kdc-options.RENEWABLE-OK is set) and
  7220.             (resp.flags.RENEWABLE) and
  7221.             (req.till != 0) and
  7222.             (resp.renew-till > req.till)) then
  7223.                 destroy resp.key;
  7224.                 return KRB_AP_ERR_MODIFIED;
  7225.         endif
  7226.  
  7227. A.5.  KRB_TGS_REQ generation
  7228.         /* Note that make_application_request might have to recursivly     */
  7229.         /* call this routine to get the appropriate ticket-granting ticket */
  7230.  
  7231.         request.pvno := protocol version; /* pvno = 5 */
  7232.         request.msg-type := message type; /* type = KRB_TGS_REQ */
  7233.  
  7234.         body.kdc-options := users's preferences;
  7235.  
  7236.  
  7237. Section A.5.               - 88 -   Expires 28 February 1993
  7238.  
  7239.  
  7240.  
  7241.  
  7242.  
  7243.  
  7244.                   Version 5 - Revision 5.1
  7245.  
  7246.  
  7247.         body.sname := service's name;
  7248.  
  7249.         if (body.kdc-options.POSTDATED is set) then
  7250.                 body.from := requested starting time;
  7251.         else
  7252.                 omit body.from;
  7253.         endif
  7254.         body.till := requested end time;
  7255.         if (body.kdc-options.RENEWABLE is set) then
  7256.                 body.rtime := requested final renewal time;
  7257.         endif
  7258.         body.nonce := random_nonce();
  7259.         body.etype := requested etypes;
  7260.         if (user supplied addresses) then
  7261.                 body.addresses := user's addresses;
  7262.         else
  7263.                 omit body.addresses;
  7264.         endif
  7265.  
  7266.         body.enc-authorization-data := user-supplied data;
  7267.         if (body.kdc-options.ENC-TKT-IN-SKEY) then
  7268.                 body.additional-tickets_ticket := second TGT;
  7269.         endif
  7270.  
  7271.         request.req-body := body;
  7272.         check := generate_checksum (req.body,checksumtype);
  7273.  
  7274.         request.padata[0].padata-type := PA-TGS-REQ;
  7275.         request.padata[0].padata-value := create a KRB_AP_REQ using
  7276.                                       the TGT and checksum
  7277.  
  7278.         /* add in any other padata as required/supplied */
  7279.  
  7280.         kerberos := lookup(name of local kerberose server (or servers));
  7281.         send(packet,kerberos);
  7282.  
  7283.         wait(for response);
  7284.         if (timed_out) then
  7285.                 retry or use alternate server;
  7286.         endif
  7287.  
  7288. A.6.  KRB_TGS_REQ verification and KRB_TGS_REP generation
  7289.         /* note that reading the application request requires first
  7290.         determining the server for which a ticket was issued, and choosing the
  7291.         correct key for decryption.  The name of the server appears in the
  7292.         plaintext part of the ticket. */
  7293.  
  7294.         if (no KRB_AP_REQ in req.padata) then
  7295.                 error_out(KDC_ERR_PADATA_TYPE_NOSUPP);
  7296.         endif
  7297.         verify KRB_AP_REQ in req.padata;
  7298.  
  7299.         /* Note that the realm in which the Kerberos server is operating is
  7300.         determined by the instance from the ticket-granting ticket.  The realm
  7301.  
  7302.  
  7303. Section A.6.               - 89 -   Expires 28 February 1993
  7304.  
  7305.  
  7306.  
  7307.  
  7308.  
  7309.  
  7310.                   Version 5 - Revision 5.1
  7311.  
  7312.  
  7313.         in the ticket-granting ticket is the realm under which the ticket
  7314.         granting ticket was issued.  It is possible for a single Kerberos
  7315.         server to support more than one realm. */
  7316.  
  7317.         auth_hdr := KRB_AP_REQ;
  7318.         tgt := auth_hdr.ticket;
  7319.  
  7320.         if (tgt.sname is not a TGT for local realm and is not req.sname) then
  7321.           error_out(KRB_AP_ERR_NOT_US);
  7322.  
  7323.         realm := realm_tgt_is_for(tgt);
  7324.  
  7325.         decode remainder of request;
  7326.  
  7327.         if (auth_hdr.authenticator.cksum type is not supported) then
  7328.                 error_out(KDC_ERR_SUMTYPE_NOSUPP);
  7329.         endif
  7330.         if (auth_hdr.authenticator.cksum is not both collision-proof and keyed) then
  7331.                 error_out(KRB_AP_ERR_INAPP_CKSUM);
  7332.         endif
  7333.         server := lookup(req.sname,realm);
  7334.  
  7335.         if (!server) then
  7336.                 if (is_foreign_tgt_name(server)) then
  7337.                         server := best_intermediate_tgs(server);
  7338.                 else
  7339.                         /* no server in Database */
  7340.                         error_out(KDC_ERR_S_PRINCIPAL_UNKNOWN);
  7341.                 endif
  7342.         endif
  7343.  
  7344.         session := generate_random_session_key();
  7345.  
  7346.  
  7347.         use_etype := first supported etype in req.etypes;
  7348.  
  7349.         if (no support for req.etypes) then
  7350.                 error_out(KDC_ERR_ETYPE_NOSUPP);
  7351.         endif
  7352.  
  7353.         new_tkt.vno := ticket version; /* = 5 */
  7354.         new_tkt.sname := req.sname;
  7355.         new_tkt.srealm := realm;
  7356.         reset all flags in new_tkt.flags;
  7357.  
  7358.         /* It should be noted that local policy may affect the  */
  7359.         /* processing of any of these flags.  For example, some */
  7360.         /* realms may refuse to issue renewable tickets         */
  7361.  
  7362.         new_tkt.caddr := tgt.caddr;
  7363.         resp.caddr := NULL; /* We only include this if they change */
  7364.         if (req.kdc-options.FORWARDABLE is set) then
  7365.                 if (tgt.flags.FORWARDABLE is reset) then
  7366.                         error_out(KDC_ERR_BADOPTION);
  7367.  
  7368.  
  7369. Section A.6.               - 90 -   Expires 28 February 1993
  7370.  
  7371.  
  7372.  
  7373.  
  7374.  
  7375.  
  7376.                   Version 5 - Revision 5.1
  7377.  
  7378.  
  7379.                 endif
  7380.                 set new_tkt.flags.FORWARDABLE;
  7381.         endif
  7382.         if (req.kdc-options.FORWARDED is set) then
  7383.                 if (tgt.flags.FORWARDABLE is reset) then
  7384.                         error_out(KDC_ERR_BADOPTION);
  7385.                 endif
  7386.                 set new_tkt.flags.FORWARDED;
  7387.                 new_tkt.caddr := req.addresses;
  7388.                 resp.caddr := req.addresses;
  7389.         endif
  7390.         if (tgt.flags.FORWARDED is set) then
  7391.                 set new_tkt.flags.FORWARDED;
  7392.         endif
  7393.  
  7394.         if (req.kdc-options.PROXIABLE is set) then
  7395.                 if (tgt.flags.PROXIABLE is reset)
  7396.                         error_out(KDC_ERR_BADOPTION);
  7397.                 endif
  7398.                 set new_tkt.flags.PROXIABLE;
  7399.         endif
  7400.         if (req.kdc-options.PROXY is set) then
  7401.                 if (tgt.flags.PROXIABLE is reset) then
  7402.                         error_out(KDC_ERR_BADOPTION);
  7403.                 endif
  7404.                 set new_tkt.flags.PROXY;
  7405.                 new_tkt.caddr := req.addresses;
  7406.                 resp.caddr := req.addresses;
  7407.         endif
  7408.  
  7409.         if (req.kdc-options.POSTDATE is set) then
  7410.                 if (tgt.flags.POSTDATE is reset)
  7411.                         error_out(KDC_ERR_BADOPTION);
  7412.                 endif
  7413.                 set new_tkt.flags.POSTDATE;
  7414.         endif
  7415.         if (req.kdc-options.POSTDATED is set) then
  7416.                 if (tgt.flags.POSTDATE is reset) then
  7417.                         error_out(KDC_ERR_BADOPTION);
  7418.                 endif
  7419.                 set new_tkt.flags.POSTDATED;
  7420.                 set new_tkt.flags.INVALID;
  7421.                 if (against_postdate_policy(req.from)) then
  7422.                         error_out(KDC_ERR_POLICY);
  7423.                 endif
  7424.                 new_tkt.starttime := req.from;
  7425.         endif
  7426.  
  7427.  
  7428.         if (req.kdc-options.VALIDATE is set) then
  7429.                 if (tgt.flags.INVALID is reset) then
  7430.                         error_out(KDC_ERR_POLICY);
  7431.                 endif
  7432.                 if (tgt.starttime > kdc_time) then
  7433.  
  7434.  
  7435. Section A.6.               - 91 -   Expires 28 February 1993
  7436.  
  7437.  
  7438.  
  7439.  
  7440.  
  7441.  
  7442.                   Version 5 - Revision 5.1
  7443.  
  7444.  
  7445.                         error_out(KRB_AP_ERR_NYV);
  7446.                 endif
  7447.                 if (check_hot_list(tgt)) then
  7448.                         error_out(KRB_AP_ERR_REPEAT);
  7449.                 endif
  7450.                 tkt := tgt;
  7451.                 reset new_tkt.flags.INVALID;
  7452.         endif
  7453.  
  7454.         if (req.kdc-options.(any flag except ENC-TKT-IN-SKEY, RENEW,
  7455.                              and those already processed) is set) then
  7456.                 error_out(KDC_ERR_BADOPTION);
  7457.         endif
  7458.  
  7459.         new_tkt.authtime := tgt.authtime;
  7460.  
  7461.         if (req.kdc-options.RENEW is set) then
  7462.           /* Note that if the endtime has already passed, the ticket would  */
  7463.           /* have been rejected in the initial authentication stage, so     */
  7464.           /* there is no need to check again here                           */
  7465.                 if (tgt.flags.RENEWABLE is reset) then
  7466.                         error_out(KDC_ERR_BADOPTION);
  7467.                 endif
  7468.                 if (tgt.renew-till >= kdc_time) then
  7469.                         error_out(KRB_AP_ERR_TKT_EXPIRED);
  7470.                 endif
  7471.                 tkt := tgt;
  7472.                 new_tkt.starttime := kdc_time;
  7473.                 old_life := tgt.endttime - tgt.starttime;
  7474.                 new_tkt.endtime := min(tgt.renew-till,
  7475.                                        new_tkt.starttime + old_life);
  7476.         else
  7477.                 new_tkt.starttime := kdc_time;
  7478.                 if (req.till = 0) then
  7479.                         till := infinity;
  7480.                 else
  7481.                         till := req.till;
  7482.                 endif
  7483.                 new_tkt.endtime := min(till,
  7484.                                        new_tkt.starttime+client.max_life,
  7485.                                        new_tkt.starttime+server.max_life,
  7486.                                        new_tkt.starttime+max_life_for_realm,
  7487.                                        tgt.endtime);
  7488.  
  7489.                 if ((req.kdc-options.RENEWABLE-OK is set) and
  7490.                     (new_tkt.endtime < req.till) and
  7491.                     (tgt.flags.RENEWABLE is set) then
  7492.                         /* we set the RENEWABLE option for later processing */
  7493.                         set req.kdc-options.RENEWABLE;
  7494.                         req.rtime := min(req.till, tgt.renew-till);
  7495.                 endif
  7496.         endif
  7497.  
  7498.         if (req.rtime = 0) then
  7499.  
  7500.  
  7501. Section A.6.               - 92 -   Expires 28 February 1993
  7502.  
  7503.  
  7504.  
  7505.  
  7506.  
  7507.  
  7508.                   Version 5 - Revision 5.1
  7509.  
  7510.  
  7511.                 rtime := infinity;
  7512.         else
  7513.                 rtime := req.rtime;
  7514.         endif
  7515.  
  7516.         if ((req.kdc-options.RENEWABLE is set) and
  7517.             (tgt.flags.RENEWABLE is set)) then
  7518.                 set new_tkt.flags.RENEWABLE;
  7519.                 new_tkt.renew-till := min(rtime,
  7520.                                           new_tkt.starttime+client.max_rlife,
  7521.                                           new_tkt.starttime+server.max_rlife,
  7522.                                           new_tkt.starttime+max_rlife_for_realm,
  7523.                                           tgt.renew-till);
  7524.         else
  7525.                 new_tkt.renew-till := OMIT; /* leave the renew-till field out */
  7526.         endif
  7527.         if (req.enc-authorization-data is present) then
  7528.                 decrypt req.enc-authorization-data into decrypted_authorization_data
  7529.                         using auth_hdr.authenticator.subkey;
  7530.                 if (decrypt_error()) then
  7531.                         error_out(KRB_AP_ERR_BAD_INTEGRITY);
  7532.                 endif
  7533.         endif
  7534.         new_tkt.authorization_data := req.auth_hdr.ticket.authorization_data +
  7535.                                  decrypted_authorization_data;
  7536.  
  7537.         new_tkt.key := session;
  7538.         new_tkt.crealm := tgt.crealm;
  7539.         new_tkt.cname := req.auth_hdr.ticket.cname;
  7540.  
  7541.         if (realm_tgt_is_for(tgt) := tgt.realm) then
  7542.                 /* tgt issued by local realm */
  7543.                 new_tkt.transited := tgt.transited;
  7544.         else
  7545.                 /* was issued for this realm by some other realm */
  7546.                 if (tgt.transited.tr-type not supported) then
  7547.                         error_out(KDC_ERR_TRTYPE_NOSUPP);
  7548.                 endif
  7549.                 new_tkt.transited := compress_transited(tgt.transited + tgt.realm)
  7550.         endif
  7551.  
  7552.         encode encrypted part of new_tkt into OCTET STRING;
  7553.         if (req.kdc-options.ENC-TKT-IN-SKEY is set) then
  7554.                 if (req.second_ticket is not a TGT) then
  7555.                         error_out(KDC_ERR_POLICY);
  7556.                 endif
  7557.  
  7558.                 new_tkt.enc-part := encrypt OCTET STRING using
  7559.                         using etype_for_key(second-ticket.key), second-ticket.key;
  7560.      else
  7561.                 new_tkt.enc-part := encrypt OCTET STRING
  7562.                         using etype_for_key(server.key), server.key, server.p_kvno;
  7563.         endif
  7564.  
  7565.  
  7566.  
  7567. Section A.6.               - 93 -   Expires 28 February 1993
  7568.  
  7569.  
  7570.  
  7571.  
  7572.  
  7573.  
  7574.                   Version 5 - Revision 5.1
  7575.  
  7576.  
  7577.         resp.pvno := 5;
  7578.         resp.msg-type := KRB_TGS_REP;
  7579.         resp.crealm := tgt.crealm;
  7580.         resp.cname := tgt.cname;
  7581.  
  7582.         resp.ticket := new_tkt;
  7583.  
  7584.         resp.key := session;
  7585.         resp.nonce := req.nonce;
  7586.         resp.last-req := fetch_last_request_info(client);
  7587.         resp.flags := new_tkt.flags;
  7588.  
  7589.         resp.authtime := new_tkt.authtime;
  7590.         resp.starttime := new_tkt.starttime;
  7591.         resp.endtime := new_tkt.endtime;
  7592.  
  7593.         omit resp.key-expiration;
  7594.  
  7595.         resp.sname := new_tkt.sname;
  7596.         resp.realm := new_tkt.realm;
  7597.  
  7598.         if (new_tkt.flags.RENEWABLE) then
  7599.                 resp.renew-till := new_tkt.renew-till;
  7600.         endif
  7601.  
  7602.  
  7603.         encode body of reply into OCTET STRING;
  7604.  
  7605.      if (req.padata.authenticator.subkey)
  7606.              resp.enc-part := encrypt OCTET STRING using use_etype,
  7607.                req.padata.authenticator.subkey;
  7608.      else resp.enc-part := encrypt OCTET STRING using use_etype, tgt.key;
  7609.  
  7610.         send(resp);
  7611.  
  7612. A.7.  KRB_TGS_REP verification
  7613.         decode response into resp;
  7614.  
  7615.         if (resp.msg-type = KRB_ERROR) then
  7616.                 process_error(resp);
  7617.                 return;
  7618.         endif
  7619.  
  7620.         /* On error, discard the response, and zero the session key from
  7621.         the response immediately */
  7622.  
  7623.      if (req.padata.authenticator.subkey)
  7624.           unencrypted part of resp := decode of decrypt of resp.enc-part
  7625.                     using resp.enc-part.etype and subkey;
  7626.      else unencrypted part of resp := decode of decrypt of resp.enc-part
  7627.                                 using resp.enc-part.etype and tgt's session key;
  7628.         if (common_as_rep_tgs_rep_checks fail) then
  7629.                 destroy resp.key;
  7630.                 return error;
  7631.  
  7632.  
  7633. Section A.7.               - 94 -   Expires 28 February 1993
  7634.  
  7635.  
  7636.  
  7637.  
  7638.  
  7639.  
  7640.                   Version 5 - Revision 5.1
  7641.  
  7642.  
  7643.         endif
  7644.  
  7645.         check authorization_data as necessary;
  7646.         save_for_later(ticket,session,client,server,times,flags);
  7647.  
  7648. A.8.  Authenticator generation
  7649.         body.authenticator-vno := authenticator vno; /* = 5 */
  7650.         body.cname, body.crealm := client name;
  7651.         if (supplying checksum) then
  7652.                 body.cksum := checksum;
  7653.         endif
  7654.         get system_time;
  7655.         body.ctime, body.cusec := system_time;
  7656.         if (selecting sub-session key) then
  7657.                 select sub-session key;
  7658.                 body.subkey := sub-session key;
  7659.         endif
  7660.         if (using sequence numbers) then
  7661.                 select initial sequence number;
  7662.                 body.seq-number := initial sequence;
  7663.         endif
  7664.  
  7665. A.9.  KRB_AP_REQ generation
  7666.         obtain ticket and session_key from cache;
  7667.  
  7668.         packet.pvno := protocol version; /* 5 */
  7669.         packet.msg-type := message type; /* KRB_AP_REQ */
  7670.  
  7671.         if (desired(MUTUAL_AUTHENTICATION)) then
  7672.                 set packet.ap-options.MUTUAL-REQUIRED;
  7673.         else
  7674.                 reset packet.ap-options.MUTUAL-REQUIRED;
  7675.         endif
  7676.         if (using session key for ticket) then
  7677.                 set packet.ap-options.USE-SESSION-KEY;
  7678.         else
  7679.                 reset packet.ap-options.USE-SESSION-KEY;
  7680.         endif
  7681.         packet.ticket := ticket; /* ticket */
  7682.         generate authenticator;
  7683.         encode authenticator into OCTET STRING;
  7684.         encrypt OCTET STRING into packet.authenticator using session_key;
  7685.  
  7686. A.10.  KRB_AP_REQ verification
  7687.         receive packet;
  7688.         if (packet.pvno != 5) then
  7689.                 either process using other protocol spec
  7690.                 or error_out(KRB_AP_ERR_BADVERSION);
  7691.         endif
  7692.         if (packet.msg-type != KRB_AP_REQ) then
  7693.                 error_out(KRB_AP_ERR_MSG_TYPE);
  7694.         endif
  7695.         if (packet.ticket.tkt_vno != 5) then
  7696.                 either process using other protocol spec
  7697.  
  7698.  
  7699. Section A.10.              - 95 -   Expires 28 February 1993
  7700.  
  7701.  
  7702.  
  7703.  
  7704.  
  7705.  
  7706.                   Version 5 - Revision 5.1
  7707.  
  7708.  
  7709.                 or error_out(KRB_AP_ERR_BADVERSION);
  7710.         endif
  7711.         if (packet.ap_options.USE-SESSION-KEY is set) then
  7712.                 retrieve session key from ticket-granting ticket for
  7713.                  packet.ticket.{sname,srealm,enc-part.etype};
  7714.         else
  7715.                 retrieve service key for
  7716.                  packet.ticket.{sname,srealm,enc-part.etype,enc-part.skvno};
  7717.         endif
  7718.         if (no_key_available) then
  7719.                 if (cannot_find_specified_skvno) then
  7720.                         error_out(KRB_AP_ERR_BADKEYVER);
  7721.                 else
  7722.                         error_out(KRB_AP_ERR_NOKEY);
  7723.                 endif
  7724.         endif
  7725.         decrypt packet.ticket.enc-part into decr_ticket using retrieved key;
  7726.         if (decryption_error()) then
  7727.                 error_out(KRB_AP_ERR_BAD_INTEGRITY);
  7728.         endif
  7729.         decrypt packet.authenticator into decr_authenticator
  7730.                 using decr_ticket.key;
  7731.         if (decryption_error()) then
  7732.                 error_out(KRB_AP_ERR_BAD_INTEGRITY);
  7733.         endif
  7734.         if (decr_authenticator.{cname,crealm} !=
  7735.             decr_ticket.{cname,crealm}) then
  7736.                 error_out(KRB_AP_ERR_BADMATCH);
  7737.         endif
  7738.         if (decr_ticket.caddr is present) then
  7739.                 if (sender_address(packet) is not in decr_ticket.caddr) then
  7740.                         error_out(KRB_AP_ERR_BADADDR);
  7741.                 endif
  7742.         elseif (application requires addresses) then
  7743.                 error_out(KRB_AP_ERR_BADADDR);
  7744.         endif
  7745.         if (not in_clock_skew(decr_authenticator.ctime,
  7746.                               decr_authenticator.cusec)) then
  7747.                 error_out(KRB_AP_ERR_SKEW);
  7748.         endif
  7749.         if (repeated(decr_authenticator.{ctime,cusec,cname,crealm})) then
  7750.                 error_out(KRB_AP_ERR_REPEAT);
  7751.         endif
  7752.         save_identifier(decr_authenticator.{ctime,cusec,cname,crealm});
  7753.         get system_time;
  7754.         if ((decr_ticket.starttime-system_time > CLOCK_SKEW) or
  7755.             (decr_ticket.flags.INVALID is set)) then
  7756.                 /* it hasn't yet become valid */
  7757.                 error_out(KRB_AP_ERR_TKT_NYV);
  7758.         endif
  7759.         if (system_time-decr_ticket.endtime > CLOCK_SKEW) then
  7760.                 error_out(KRB_AP_ERR_TKT_EXPIRED);
  7761.         endif
  7762.         /* caller must check decr_ticket.flags for any pertinent details */
  7763.  
  7764.  
  7765. Section A.10.              - 96 -   Expires 28 February 1993
  7766.  
  7767.  
  7768.  
  7769.  
  7770.  
  7771.  
  7772.                   Version 5 - Revision 5.1
  7773.  
  7774.  
  7775.         return(OK, decr_ticket, packet.ap_options.MUTUAL-REQUIRED);
  7776.  
  7777. A.11.  KRB_AP_REP generation
  7778.         packet.pvno := protocol version; /* 5 */
  7779.         packet.msg-type := message type; /* KRB_AP_REP */
  7780.  
  7781.         body.ctime := packet.ctime;
  7782.         body.cusec := packet.cusec;
  7783.         if (selecting sub-session key) then
  7784.                 select sub-session key;
  7785.                 body.subkey := sub-session key;
  7786.         endif
  7787.         if (using sequence numbers) then
  7788.                 select initial sequence number;
  7789.                 body.seq-number := initial sequence;
  7790.         endif
  7791.  
  7792.         encode body into OCTET STRING;
  7793.  
  7794.         select encryption type;
  7795.         encrypt OCTET STRING into packet.enc-part;
  7796.  
  7797. A.12.  KRB_AP_REP verification
  7798.         receive packet;
  7799.         if (packet.pvno != 5) then
  7800.                 either process using other protocol spec
  7801.                 or error_out(KRB_AP_ERR_BADVERSION);
  7802.         endif
  7803.         if (packet.msg-type != KRB_AP_REP) then
  7804.                 error_out(KRB_AP_ERR_MSG_TYPE);
  7805.         endif
  7806.         cleartext := decrypt(packet.enc-part) using ticket's session key;
  7807.         if (decryption_error()) then
  7808.                 error_out(KRB_AP_ERR_BAD_INTEGRITY);
  7809.         endif
  7810.         if (cleartext.ctime != authenticator.ctime) then
  7811.                 error_out(KRB_AP_ERR_MUT_FAIL);
  7812.         endif
  7813.         if (cleartext.cusec != authenticator.cusec) then
  7814.                 error_out(KRB_AP_ERR_MUT_FAIL);
  7815.         endif
  7816.         if (cleartext.subkey is present) then
  7817.                 save cleartext.subkey for future use;
  7818.         endif
  7819.         if (cleartext.seq-number is present) then
  7820.                 save cleartext.seq-number for future verifications;
  7821.         endif
  7822.         return(AUTHENTICATION_SUCCEEDED);
  7823.  
  7824. A.13.  KRB_SAFE generation
  7825.         collect user data in buffer;
  7826.  
  7827.         /* assemble packet: */
  7828.         packet.pvno := protocol version; /* 5 */
  7829.  
  7830.  
  7831. Section A.13.              - 97 -   Expires 28 February 1993
  7832.  
  7833.  
  7834.  
  7835.  
  7836.  
  7837.  
  7838.                   Version 5 - Revision 5.1
  7839.  
  7840.  
  7841.         packet.msg-type := message type; /* KRB_SAFE */
  7842.  
  7843.         body.user-data := buffer; /* DATA */
  7844.         if (using timestamp) then
  7845.                 get system_time;
  7846.                 body.timestamp, body.usec := system_time;
  7847.         endif
  7848.         if (using sequence numbers) then
  7849.                 body.seq-number := sequence number;
  7850.         endif
  7851.         body.s-address := sender host addresses;
  7852.         if (only one recipient) then
  7853.                 body.r-address := recipient host address;
  7854.         endif
  7855.         checksum.cksumtype := checksum type;
  7856.         compute checksum over body;
  7857.         checksum.checksum := checksum value; /* checksum.checksum */
  7858.         packet.cksum := checksum;
  7859.         packet.safe-body := body;
  7860.  
  7861. A.14.  KRB_SAFE verification
  7862.         receive packet;
  7863.         if (packet.pvno != 5) then
  7864.                 either process using other protocol spec
  7865.                 or error_out(KRB_AP_ERR_BADVERSION);
  7866.         endif
  7867.         if (packet.msg-type != KRB_SAFE) then
  7868.                 error_out(KRB_AP_ERR_MSG_TYPE);
  7869.         endif
  7870.         if (packet.checksum.cksumtype is not both collision-proof and keyed) then
  7871.                 error_out(KRB_AP_ERR_INAPP_CKSUM);
  7872.         endif
  7873.         if (safe_priv_common_checks_ok(packet)) then
  7874.                 set computed_checksum := checksum(packet.body);
  7875.                 if (computed_checksum != packet.checksum) then
  7876.                         error_out(KRB_AP_ERR_MODIFIED);
  7877.                 endif
  7878.                 return (packet, PACKET_IS_GENUINE);
  7879.         else
  7880.                 return common_checks_error;
  7881.         endif
  7882.  
  7883. A.15.  KRB_SAFE and KRB_PRIV common checks
  7884.         if (packet.s-address != O/S_sender(packet)) then
  7885.                 /* O/S report of sender not who claims to have sent it */
  7886.                 error_out(KRB_AP_ERR_BADADDR);
  7887.         endif
  7888.         if ((packet.r-address is present) and
  7889.             (packet.r-address != local_host_address)) then
  7890.                 /* was not sent to proper place */
  7891.                 error_out(KRB_AP_ERR_BADADDR);
  7892.         endif
  7893.         if (((packet.timestamp is present) and
  7894.              (not in_clock_skew(packet.timestamp,packet.usec))) or
  7895.  
  7896.  
  7897. Section A.15.              - 98 -   Expires 28 February 1993
  7898.  
  7899.  
  7900.  
  7901.  
  7902.  
  7903.  
  7904.                   Version 5 - Revision 5.1
  7905.  
  7906.  
  7907.             (packet.timestamp is not present and timestamp expected)) then
  7908.                 error_out(KRB_AP_ERR_SKEW);
  7909.         endif
  7910.         if (repeated(packet.timestamp,packet.usec,packet.s-address)) then
  7911.                 error_out(KRB_AP_ERR_REPEAT);
  7912.         endif
  7913.         if (((packet.seq-number is present) and
  7914.              ((not in_sequence(packet.seq-number)))) or
  7915.             (packet.seq-number is not present and sequence expected)) then
  7916.                 error_out(KRB_AP_ERR_BADORDER);
  7917.         endif
  7918.         if (packet.timestamp not present and packet.seq-number not present) then
  7919.                 error_out(KRB_AP_ERR_MODIFIED);
  7920.         endif
  7921.  
  7922.         save_identifier(packet.{timestamp,usec,s-address},
  7923.                         sender_principal(packet));
  7924.  
  7925.         return PACKET_IS_OK;
  7926.  
  7927. A.16.  KRB_PRIV generation
  7928.         collect user data in buffer;
  7929.  
  7930.         /* assemble packet: */
  7931.         packet.pvno := protocol version; /* 5 */
  7932.         packet.msg-type := message type; /* KRB_PRIV */
  7933.  
  7934.         packet.enc-part.etype := encryption type;
  7935.  
  7936.         body.user-data := buffer;
  7937.         if (using timestamp) then
  7938.                 get system_time;
  7939.                 body.timestamp, body.usec := system_time;
  7940.         endif
  7941.         if (using sequence numbers) then
  7942.                 body.seq-number := sequence number;
  7943.         endif
  7944.         body.s-address := sender host addresses;
  7945.         if (only one recipient) then
  7946.                 body.r-address := recipient host address;
  7947.         endif
  7948.  
  7949.         encode body into OCTET STRING;
  7950.  
  7951.         select encryption type;
  7952.         encrypt OCTET STRING into packet.enc-part.cipher;
  7953.  
  7954.  
  7955. A.17.  KRB_PRIV verification
  7956.         receive packet;
  7957.         if (packet.pvno != 5) then
  7958.                 either process using other protocol spec
  7959.                 or error_out(KRB_AP_ERR_BADVERSION);
  7960.         endif
  7961.  
  7962.  
  7963. Section A.17.              - 99 -   Expires 28 February 1993
  7964.  
  7965.  
  7966.  
  7967.  
  7968.  
  7969.  
  7970.                   Version 5 - Revision 5.1
  7971.  
  7972.  
  7973.         if (packet.msg-type != KRB_PRIV) then
  7974.                 error_out(KRB_AP_ERR_MSG_TYPE);
  7975.         endif
  7976.  
  7977.         cleartext := decrypt(packet.enc-part) using negotiated key;
  7978.         if (decryption_error()) then
  7979.                 error_out(KRB_AP_ERR_BAD_INTEGRITY);
  7980.         endif
  7981.  
  7982.         if (safe_priv_common_checks_ok(cleartext)) then
  7983.                 return(cleartext.DATA, PACKET_IS_GENUINE_AND_UNMODIFIED);
  7984.         else
  7985.                 return common_checks_error;
  7986.         endif
  7987.  
  7988. A.18.  KRB_ERROR generation
  7989.  
  7990.         /* assemble packet: */
  7991.         packet.pvno := protocol version; /* 5 */
  7992.         packet.msg-type := message type; /* KRB_ERROR */
  7993.  
  7994.         get system_time;
  7995.         packet.stime, packet.susec := system_time;
  7996.         packet.realm, packet.sname := server name;
  7997.  
  7998.         if (client time available) then
  7999.                 packet.ctime, packet.cusec := client_time;
  8000.         endif
  8001.         packet.error-code := error code;
  8002.         if (client name available) then
  8003.                 packet.cname, packet.crealm := client name;
  8004.         endif
  8005.         if (error text available) then
  8006.                 packet.e-text := error text;
  8007.         endif
  8008.         if (error data available) then
  8009.                 packet.e-data := error data;
  8010.         endif
  8011.  
  8012.  
  8013.  
  8014.  
  8015.  
  8016.  
  8017.  
  8018.  
  8019.  
  8020.  
  8021.  
  8022.  
  8023.  
  8024.  
  8025.  
  8026.  
  8027.  
  8028.  
  8029.  
  8030.                            - c -    Expires 28 February 1993
  8031.  
  8032.  
  8033.  
  8034.  
  8035.  
  8036.  
  8037.  
  8038.  
  8039.  
  8040.  
  8041.  
  8042.  
  8043.                      Table of Contents
  8044.  
  8045.  
  8046.  
  8047.  
  8048. Overview ..............................................    1
  8049.  
  8050. Background ............................................    2
  8051.  
  8052. 1. Introduction .......................................    2
  8053.  
  8054. 1.1. Cross-Realm Operation ............................    4
  8055.  
  8056. 1.2. Environmental assumptions ........................    5
  8057.  
  8058. 1.3. Glossary of terms ................................    6
  8059.  
  8060. 2. Ticket flag uses and requests ......................    9
  8061.  
  8062. 2.1. Initial and pre-authenticated tickets ............    9
  8063.  
  8064. 2.2. Invalid tickets ..................................    9
  8065.  
  8066. 2.3. Renewable tickets ................................    9
  8067.  
  8068. 2.4. Postdated tickets ................................   10
  8069.  
  8070. 2.5. Proxiable and proxy tickets ......................   11
  8071.  
  8072. 2.6. Forwardable tickets ..............................   12
  8073.  
  8074. 2.7. Other KDC options ................................   12
  8075.  
  8076. 3. Message Exchanges ..................................   13
  8077.  
  8078. 3.1. The Authentication Service Exchange ..............   13
  8079.  
  8080. 3.1.1. Generation of KRB_AS_REQ message ...............   14
  8081.  
  8082. 3.1.2. Receipt of KRB_AS_REQ message ..................   14
  8083.  
  8084. 3.1.3. Generation of KRB_AS_REP message ...............   14
  8085.  
  8086. 3.1.4. Generation of KRB_ERROR message ................   16
  8087.  
  8088. 3.1.5. Receipt of KRB_AS_REP message ..................   16
  8089.  
  8090. 3.1.6. Receipt of KRB_ERROR message ...................   17
  8091.  
  8092. 3.2. The Client/Server Authentication Exchange ........   17
  8093.  
  8094.  
  8095.  
  8096.                            - i -    Expires 28 February 1993
  8097.  
  8098.  
  8099.  
  8100.  
  8101.  
  8102.  
  8103.                   Version 5 - Revision 5.1
  8104.  
  8105.  
  8106. 3.2.1. The KRB_AP_REQ message .........................   17
  8107.  
  8108. 3.2.2. Generation of a KRB_AP_REQ message .............   18
  8109.  
  8110. 3.2.3. Receipt of KRB_AP_REQ message ..................   18
  8111.  
  8112. 3.2.4. Generation of a KRB_AP_REP message .............   20
  8113.  
  8114. 3.2.5. Receipt of KRB_AP_REP message ..................   21
  8115.  
  8116. 3.2.6. Using the encryption key .......................   21
  8117.  
  8118. 3.3. The Ticket-Granting Service (TGS) Exchange .......   22
  8119.  
  8120. 3.3.1. Generation of KRB_TGS_REQ message ..............   23
  8121.  
  8122. 3.3.2. Receipt of KRB_TGS_REQ message .................   24
  8123.  
  8124. 3.3.3. Generation of KRB_TGS_REP message ..............   25
  8125.  
  8126. 3.3.3.1. Encoding the transited field .................   27
  8127.  
  8128. 3.3.4. Receipt of KRB_TGS_REP message .................   29
  8129.  
  8130. 3.4. The KRB_SAFE Exchange ............................   29
  8131.  
  8132. 3.4.1. Generation of a KRB_SAFE message ...............   29
  8133.  
  8134. 3.4.2. Receipt of KRB_SAFE message ....................   30
  8135.  
  8136. 3.5. The KRB_PRIV Exchange ............................   30
  8137.  
  8138. 3.5.1. Generation of a KRB_PRIV message ...............   31
  8139.  
  8140. 3.5.2. Receipt of KRB_PRIV message ....................   31
  8141.  
  8142. 4. The Kerberos Database ..............................   32
  8143.  
  8144. 4.1. Database contents ................................   32
  8145.  
  8146. 4.2. Additional fields ................................   33
  8147.  
  8148. 4.3. Frequently Changing Fields .......................   34
  8149.  
  8150. 4.4. Site Constants ...................................   34
  8151.  
  8152. 5. Message Specifications .............................   35
  8153.  
  8154. 5.1. ASN.1 Distinguished Encoding Representation ......   35
  8155.  
  8156. 5.2. ASN.1 Base Definitions ...........................   35
  8157.  
  8158. 5.3. Tickets and Authenticators .......................   38
  8159.  
  8160.  
  8161.  
  8162.                            - ii -   Expires 28 February 1993
  8163.  
  8164.  
  8165.  
  8166.  
  8167.  
  8168.  
  8169.                   Version 5 - Revision 5.1
  8170.  
  8171.  
  8172. 5.3.1. Tickets ........................................   38
  8173.  
  8174. 5.3.2. Authenticators .................................   44
  8175.  
  8176. 5.4. Specifications for the AS and TGS exchanges ......   45
  8177.  
  8178. 5.4.1. KRB_KDC_REQ definition .........................   45
  8179.  
  8180. 5.4.2. KRB_KDC_REP definition .........................   52
  8181.  
  8182. 5.5. Client/Server (CS) message specifications ........   55
  8183.  
  8184. 5.5.1. KRB_AP_REQ definition ..........................   55
  8185.  
  8186. 5.5.2. KRB_AP_REP definition ..........................   56
  8187.  
  8188. 5.5.3. Error message reply ............................   57
  8189.  
  8190. 5.6. KRB_SAFE message specification ...................   57
  8191.  
  8192. 5.6.1. KRB_SAFE definition ............................   57
  8193.  
  8194. 5.7. KRB_PRIV message specification ...................   59
  8195.  
  8196. 5.7.1. KRB_PRIV definition ............................   59
  8197.  
  8198. 5.8. Error message specification ......................   60
  8199.  
  8200. 5.8.1. KRB_ERROR definition ...........................   60
  8201.  
  8202. 6. Encryption and Checksum Specifications .............   62
  8203.  
  8204. 6.1. Encryption Specifications ........................   63
  8205.  
  8206. 6.2. Encryption Keys ..................................   65
  8207.  
  8208. 6.3. Encryption Systems ...............................   66
  8209.  
  8210. 6.3.1. The NULL Encryption System (null) ..............   66
  8211.  
  8212. 6.3.2. DES in CBC mode with a CRC-32 checksum (des-
  8213. cbc-crc) ..............................................   66
  8214.  
  8215. 6.3.3. DES in CBC mode with an MD4 checksum (des-
  8216. cbc-md4) ..............................................   67
  8217.  
  8218. 6.3.4. DES in CBC mode with an MD5 checksum (des-
  8219. cbc-md5) ..............................................   67
  8220.  
  8221. 6.4. Checksums ........................................   68
  8222.  
  8223. 6.4.1. The CRC-32 Checksum (crc32) ....................   69
  8224.  
  8225. 6.4.2. The RSA MD4 Checksum (rsa-md4) .................   69
  8226.  
  8227.  
  8228.                           - iii -   Expires 28 February 1993
  8229.  
  8230.  
  8231.  
  8232.  
  8233.  
  8234.  
  8235.                   Version 5 - Revision 5.1
  8236.  
  8237.  
  8238. 6.4.3. RSA MD4 Cryptographic Checksum Using DES
  8239. (rsa-md4-des) .........................................   70
  8240.  
  8241. 6.4.4. The RSA MD5 Checksum (rsa-md5) .................   71
  8242.  
  8243. 6.4.5. RSA MD5 Cryptographic Checksum Using DES
  8244. (rsa-md5-des) .........................................   71
  8245.  
  8246. 6.4.6. DES cipher-block chained checksum (des-mac)
  8247.  
  8248. 6.4.7. RSA MD4 Cryptographic Checksum Using DES
  8249. alternative (rsa-md4-des-k) ...........................   72
  8250.  
  8251. 6.4.8. DES cipher-block chained checksum alternative
  8252. (des-mac-k) ...........................................   72
  8253.  
  8254. 7. Naming Constraints .................................   73
  8255.  
  8256. 7.1. Realm Names ......................................   73
  8257.  
  8258. 7.2. Principal Names ..................................   74
  8259.  
  8260. 8. Constants and other defined values .................   75
  8261.  
  8262. 8.1. Host address types ...............................   75
  8263.  
  8264. 8.2. KDC messages .....................................   76
  8265.  
  8266. 8.2.1. IP transport ...................................   76
  8267.  
  8268. 8.2.2. OSI transport ..................................   76
  8269.  
  8270. 8.2.3. Name of the TGS ................................   77
  8271.  
  8272. 8.3. Protocol constants and associated values .........   77
  8273.  
  8274. 9. Interoperability requirements ......................   79
  8275.  
  8276. 9.1. Specification 1 ..................................   80
  8277.  
  8278. 9.2. Recommended KDC values ...........................   81
  8279.  
  8280. 10. Acknowledgments ...................................   81
  8281.  
  8282. 11. REFERENCES ........................................   82
  8283.  
  8284. A. Pseudo-code for protocol processing ................   84
  8285.  
  8286. A.1. KRB_AS_REQ generation ............................   84
  8287.  
  8288. A.2. KRB_AS_REQ verification and KRB_AS_REP genera-
  8289. tion ..................................................   84
  8290.  
  8291. A.3. KRB_AS_REP verification ..........................   87
  8292.  
  8293.  
  8294.                            - iv -   Expires 28 February 1993
  8295.  
  8296.  
  8297.  
  8298.  
  8299.  
  8300.  
  8301.                   Version 5 - Revision 5.1
  8302.  
  8303.  
  8304. A.4. KRB_AS_REP and KRB_TGS_REP common checks .........   88
  8305.  
  8306. A.5. KRB_TGS_REQ generation ...........................   88
  8307.  
  8308. A.6. KRB_TGS_REQ verification and KRB_TGS_REP gen-
  8309. eration ...............................................   89
  8310.  
  8311. A.7. KRB_TGS_REP verification .........................   94
  8312.  
  8313. A.8. Authenticator generation .........................   95
  8314.  
  8315. A.9. KRB_AP_REQ generation ............................   95
  8316.  
  8317. A.10. KRB_AP_REQ verification .........................   95
  8318.  
  8319. A.11. KRB_AP_REP generation ...........................   97
  8320.  
  8321. A.12. KRB_AP_REP verification .........................   97
  8322.  
  8323. A.13. KRB_SAFE generation .............................   97
  8324.  
  8325. A.14. KRB_SAFE verification ...........................   98
  8326.  
  8327. A.15. KRB_SAFE and KRB_PRIV common checks .............   98
  8328.  
  8329. A.16. KRB_PRIV generation .............................   99
  8330.  
  8331. A.17. KRB_PRIV verification ...........................   99
  8332.  
  8333. A.18. KRB_ERROR generation ............................  100
  8334.  
  8335.  
  8336.  
  8337.  
  8338.  
  8339.  
  8340.  
  8341.  
  8342.  
  8343.  
  8344.  
  8345.  
  8346.  
  8347.  
  8348.  
  8349.  
  8350.  
  8351.  
  8352.  
  8353.  
  8354.  
  8355.  
  8356.  
  8357.  
  8358.  
  8359.  
  8360.                            - v -    Expires 28 February 1993
  8361.  
  8362.  
  8363.  
  8364.